0

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.

5
  • enctype="multipart/form-data"
    – E L
    Commented Feb 1, 2013 at 21:43
  • Are you sure it is Raspberry Pi specific? Does it work on your localhost or test server?
    – Arnold Daniels
    Commented Feb 1, 2013 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
    Commented Feb 1, 2013 at 22:41
  • what phpinfo() says?
    – E L
    Commented Feb 2, 2013 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
    Commented Feb 4, 2013 at 20:53

1 Answer 1

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.

1
  • 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
    Commented Feb 1, 2013 at 22:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .