Results 1 to 6 of 6

Thread: How to Manage File Uploads in PHP?

  1. #1
    Join Date
    Jul 2006
    Posts
    128

    How to Manage File Uploads in PHP?

    Hello friends,
    I have done enough programs in PHP programming language. I have also done the C++ and Core Java. I have been told to upload the file in PHP but I am not having any idea of that. So I thought that there might be someone over there who may be interested in helping me. So please tell me how to manage the file uploads in PHP..?? Any other information related to the topic would be grateful.!!
    "Every man is guilty of all the good he did not do". - Voltaire

  2. #2
    Join Date
    Mar 2008
    Posts
    672

    Re: How to Manage File Uploads in PHP?

    You should know that you can do the file upload by using the POST method. This feature lets people upload both text and binary files. With the functions of identification and handling of PHP files, you have total control to define who has the right to download but also what will be done with the file once it is downloaded. PHP also supports loading the PUT method as in Netscape Composer and W3C Amaya. The global variable $ _FILES exists as of PHP 4.1.0. The PHP script which receives the uploaded file will handle the file appropriately. You can use the variable $ _FILES [ 'userfile'] [ 'size'] to throw away any files that are too big or too small. You can use the variable $ _FILES [ 'userfile'] [ 'type'] to remove the files that have the wrong type.

  3. #3
    Join Date
    Aug 2006
    Posts
    227

    Re: How to Manage File Uploads in PHP?

    I would like to tell you that you should note that the MAX_FILE_SIZE hidden field is only used by the PHP script which receives the request, as an instruction to reject files larger than the given bound. This field has no significance for the browser, it does not provide a client-side check of the file-size, and it has nothing to do with web standards or browser features. Since PHP 4.2.0, PHP returns an appropriate error code in the table file. This error code is available to index [ 'error'] table, which is created during the download, by PHP. In other words, the error is available in the variable $ _FILES [ 'userfile'] [ 'error'].
    I do to dead flowers what people at morgues do to dead people. Suck all the moisture out, dip them in plastic, paint them up pretty and put them in a nice frame.

  4. #4
    Join Date
    Jul 2006
    Posts
    286

    Re: Errors : While Managing File Uploads in PHP

    The following are some errors that occur when you are uploading the file in PHP :
    • UPLOAD_ERR_OK - No error, the download is correct.
    • UPLOAD_ERR_INI_SIZE - Value: 1. The downloaded file size exceeds upload_max_filesize, configured in php.ini.
    • UPLOAD_ERR_FORM_SIZE - Value: 2. The uploaded file exceeds the size of MAX_FILE_SIZE, which was specified in the HTML form.
    • UPLOAD_ERR_PARTIAL - Value: 3. The file was only partially uploaded.
    • UPLOAD_ERR_NO_FILE - Value: 4. No files have been downloaded.
    • UPLOAD_ERR_NO_TMP_DIR - Value: 6. A temporary folder is missing. Introduced in PHP 4.3.10 and PHP 5.0.3.
    IF you hate me, please don't mention it. I know who hates me and who doesn't. You really do not have to make fun of people....

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: How to Manage File Uploads in PHP?

    The MAX_FILE_SIZE item can not specify a file size larger than the size that was set by upload_max_filesize in php.ini. The default is 2 megabytes. If a memory limit is enabled, a larger value of memory_limit may be needed. Make sure you set a value for memory_limit large enough. If the value of max_execution_time is too small, the execution time of the script can exceed this value. Make sure you set a value for max_execution_time large enough. You should note that max_execution_time only affects the execution time of the script.

  6. #6
    Join Date
    Apr 2008
    Posts
    2,005

    Re: max_input_time in PHP?

    I would like to tell more about the max_input_time, since many times it plays an important role. The max_input_time sets the maximum time in seconds the script to receive data that includes downloading the file. For multiple files or big files or for users on slow connections, the default of 60 seconds may be exceeded. If post_max_size is set too low, large files can not be downloaded. Make sure you set post_max_size large enough. Do not commit files that you can handle giving the user access to sensitive files in other folders. The developer may not mix normal input fields and fields for downloading in a single variable.

Similar Threads

  1. Outlook .pst File too Large to Manage
    By jean-paul martell in forum Windows Software
    Replies: 9
    Last Post: 13-06-2012, 11:40 AM
  2. How to Manage File Permission in Unix
    By blueprats in forum Guides & Tutorials
    Replies: 1
    Last Post: 17-06-2010, 01:24 PM
  3. Manage file sharing in windows 7
    By Rubeen in forum Networking & Security
    Replies: 5
    Last Post: 15-02-2010, 10:56 AM
  4. Windows 7 HTTP uploads is faster then possible
    By RPVG in forum Operating Systems
    Replies: 3
    Last Post: 08-10-2009, 01:20 PM
  5. YouTube Uploads with Very High Quality
    By Jaiwanti in forum Technology & Internet
    Replies: 3
    Last Post: 17-07-2009, 11:46 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,965,801.85871 seconds with 16 queries