开发者

Uploading files wont work on production server

I have a php script which uploads images to a temporary folder on the server.

This works on my local computer with the local (virtual) server. (wampserver).

However, on the production server (linux) I cant get it working.

Everything is loading as it should, except for that the file doesn't show开发者_JAVA技巧 up on the server.

My Q is, is there anything I should think about when moving to a production server with uploading images or files?

I have set permissions on the folder where the images are supposed to go to 777 and also the php-code which uploads them to 777.

Thanks


is there anything I should think about when moving to a production server with uploading images or files?

Yes.
Error handling.
You have to keep in touch with PHP error reporting in general
and properly handle $_FILES['name']['error'] variable in case of upload.

These two sources will provide you with sufficient and precise information on any error occurred.


I highly recommend to you first to read this article before setting 777 permission on the server. Besides, there are different ways of uploading files are shown, so I think you will solve your problems after reading this article.
Good luck


I know this question is old but I doubt any of the answers given are correct as I have had this exact problem and it turned out to be that when I created the php form I forgot to add this line to the form tag enctype="multipart/form-data" so processing the form on my local machine worked fine but when I tried to upload an image to the production server with the form it wouldn't process the image file, it would process all the other data from the form just not the file that needed to be uploaded. After I added the line above it worked fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜