Back to Top
The nuts and bolts for
Creative web development

Upload Problems - Permissons could hold the key

When uploading a file to your webserver most people are already aware that the folder where the file resides must have the correct permissions to accept the uploaded file.

In most cases this will be 755 or 777 (try 755 first, always leave 777 as a last resort), however, what do you do if the permissions are correct and the upload still fails ?

To help understand this, I will explain what happens when you upload a file using HTTP and PHP.

You select the file for upload, click Submit and the file uploads to a temporary directory on the webserver. The PHP script then validates this upload. This is done to ensure that nobody has tried to trick the system.

When the file has been validated it is copied to the destination folder, and the original file in the temporary directory is deleted.

Explaining this procedure should highlight where the problem occurs if the upload is failing. Does the temporary directory on the webserver have the correct permissions ? Probably not. Change the permissions to 755 (or 777, see note above) and this should resolve the problem.

Tim Green

Tim Green36 Years Old and recently married. Initially started as a COBOL, PASCAL, FORTRAN, ALGOL, 6502 and Z80 Assembly language programmer at age 16.

At age 19 I chased a career in acting where I had a couple of 'Extra' roles and appeared in 'Robin Hood' (no not the Kevin Costner one). Missed out on my big break when I contracted pneumonia which stopped me working on Aliens 3.

Following a 5 year stretch as a casual barman, chef and waiter on Spain's Costa Brava, I returned to the UK where I began work, on a VERY busy IT Support helpline.

Quickly moving through the ranks to Team Leader of Hardware, Software, 2nd level and Principle Support, I finally left after raising the service level from 17% to 98% and getting demoted by way of reward.

CEO of The Rawveg Consultancy, I provide custom extension development services, IT Consultancy, B2B and eBusiness consultancy services.

See All Postings From Tim Green >>

Share this Article

Comments

copy to real dir

How long does it take to copy itself to the real dir and remove from the tmp folder??

RE: Change permission

You can do this in a number of ways. The most common methods are by using TELNET or FTP.

As the majority of web hosts do not provide TELNET access to the webserver, you will most probably need to do it using your FTP client.

In CuteFTP for example you would right click on a folder, select permissions and in the text box you would type 755 (or 777) depending.

You will find that different pieces of software accomplish this in many ways. I would suggest that your read the manuals for your FTP software and they will give you more accurate details.

Change permission

How can I Change the permissions to 755 or 777?  Please tell me in details. 

Thank you,

Ten