Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a local LAN server running on a Raspberry Pi (apache2) with PHP installed. I know that PHP is working, because I wrote a test file, echo "Hello, World!" and it worked. But, whenever I upload a file on the same router to the server through a PHP script, it doesn't work. If I try to upload a file on the Raspberry Pi itself, it works fine.

F.Y.I, I'm trying to do this so I can then print the uploaded file (which is working fine on local files on the Raspberry Pi). Is this an issue with port forwarding or something? I am new to this whole area of computing (I am mainly a software developer). If it is a port forwarding problem, my router/modem is the Virgin Media Super Hub. In the apache2 server error log, it says that $_FILES["file"]["tmp_name"] is not a file ("file" is the input name). For some reason, this happens as well on all the machines I've tested it on. But no problems on a file on the Raspberry Pi.

share|improve this question

migrated from Feb 2 '13 at 9:41

This question came from our site for professional and enthusiast programmers.

enctype="multipart/form-data" – E L Feb 1 '13 at 21:43
Are you sure it is Raspberry Pi specific? Does it work on your localhost or test server? – Arnold Daniels Feb 1 '13 at 21:43
I am using the Raspberry Pi. And no, I can't connect to the server through "localhost", I can only connect through the local ip address of the raspberry pi – Rees Feb 1 '13 at 22:41
what phpinfo() says? – E L Feb 2 '13 at 0:22
I have a feeling this is a permissions thing. When you upload through the PHP script, the user running as your webserver [usually nouser or www-data] versus uploading it as user "pi" -- Please do an "ls -la" on that upload directory and let's compare the permissions for files uploaded using the two different methods. – armani Feb 4 '13 at 20:53

1 Answer 1

you need to specify in your form the encryption type that it is multipart using

<form enctype="multipart/form-data" action="whatever.php" method="post"></form>

and F.Y.I you would need to move_uploaded_file if you wish to re-use the same file later.

share|improve this answer
Yeah, sorry to not specify, but I looked at the w3schools site, and I am using the right encryption type. As I said, it is working for local files being "uploaded" from the raspberry pi to the raspberry pi – Rees Feb 1 '13 at 22:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.