403 error when trying to upload files

I get a 403 error when I upload a file and call move_uploaded_file.

It seems that the tmp directory is unreachable.

Here's the code...
foreach ($_FILES as $fieldName => $file) {
$filenames .= $fieldName. "\n";
if(move_uploaded_file($file['tmp_name'], "./images/" . $file['name'])) {
echo "The file ". $file['name'] . " has been uploaded";
} else{
echo "There was an error uploading the file" . "./images/" . $file['name'] . ", please try again!";
}
}

The php echoes the error clause when it runs.
My Flash app reports a 403 error.

Is there some configuration I need to do to be able to use this function?

P.S. the same code works on my windows server. This code fails on the Linux server.

-- Thanks,
Shannon Vance
 
Actually, not a Flash issue but an Apache issue. A few months back JodoHost added the security filtering, or turned it on, or something. Uploads and POSTs are now scanned to prevent various hack techniques. You can submit a ticket and they'll help you resolve or you can turn off security filtering as your htaccess change does. That latter method is less secure, though I have to admit to doing it on a few client sites.

Tim
 
Actually, I did submit a ticket.
I got this as a reply..
I see below error in logs:
--------------------------------------------
Error processing request body: Multipart: final boundary missing
--------------------------------------------
Then I was suggested to go to a link that had this...

-----------------------------------------------
This error message from ModSecurity means that the request body was not
properly constructed or something was wrong with the file upload (most
likely that the client timed out and did not fully complete the upload).

Other possible reasons for this -

1) If the end of the final boundary is missing a CRLF
2) If the size specified in the Content-Length header is too small. In
this case, Apache would cut off the end of the file.

------------------------------------------------------------

I was just using standard php code (there's countless examples on the net, I used the stuff from php.net) to do the upload. So I have no clue as to what was wrong.

Another thing. My client side was an html file-upload form (another copy from the php.net site) and also a Flash app.
(The html form was used just to test file uploads in a non-flash environment).

If anyone has any idea about what is going on, I'd love to hear about it!

Thanks,
Shannon
 
Back
Top