|
Free Educational Resource Center for teachers and students. Includes Interviews, Sourcecode, Free Software, Research Papers, Articles, Tutorials and much more.. |
R E S E A R C H A C T I V I T Y . C O M
Our Fellow Research Center for Ph.D Schollars |
|
| Home About Submit & Earn | Archives: C And C + + Programming » Dev Packages » Interviews » Php Mysql Programming » Windows Programming | |
|
Php Mysql Programming > easy way to upload files using php
Easy way to Upload files using PHP There is a traditional way of uploading files in php usually developers use, that is, use functions is_uploaded_file() and move_uplaoded_file(). These functions my create problems sometimes. function move_uplaoded_file() sometimes does not let you move file to a specific folder, may be becuase your account does not have permission to move a temporary file to some folder in your account. I encountered same problem when my client reported me that he has ful permissions to write a file anywhere in any folder, and he has successfully chmod-ed the folders to 777 / 666 (on unix server), but he still cannot get the admin panel script to perform uploading of image. Then I came to know that I must not use move_uplaoded_file, but find some other way to read the file data and write it myself whereever I want. So I came up with following things.
Now we have full data of file in variable $file_data and we can use it to write the file anywhere allowed. For example you wish to write the uplaoded file 'mynewfile.png' to a sub folder called 'myfiles', you write as.
That's it - you nomore need to use move_uploaded_file. |