Hi sstvmaster,
Many thanks for your input!
(Indeed, forgot to mention this is a LAMP server (Linux, Apache, MySQL, PHP))
Your are correct. The problem had to do with permissions/rights.
When setting up my server I set the ownership to me (user):
sudo chown -R $USER:$USER /var/www/mydomain
What I needed to do was set the owner to Apache itself which has the name www-data. So this would be:
sudo chown -R www-data:www-data /var/www/mydomain
then also:
sudo chmod -R 755 /var/www/mydomain
In addition you need to make sure that PHP which handles the operation server side allows file uploads. This can be found in the PHP ini file (it usually does allow this as this is the default setting).
In your "php.ini" file, search for the file_uploads directive, it must read:
You may need to also increase the upload file size limit (shows up as errorcode 1) in the php.ini file as well:
upload_max_filesize = 3M post_max_size = 3M
Here we set maximum file size that can be uploaded to 3mb.
To get some feedback on things you must also check your error and access logs. These can be found:
/var/log/apache2
Here is the PHP file with some added stuff. The first 3 statement provide some error checking. PHP is not that intuitive for a Pascal coder. $_FILES var which includes 'name' is actually an array that include things like size, type, error tmp_name. I have added this to the PHP file. I have added
basename which ExtractsFileName. Notice that
bin relates to field name in the client side pascal code.
<?php
ini_set('display_startup_errors', 1);
if (isset($_FILES['bin']['name']) && !empty($_FILES['bin']['name'])) {
$tmp_name_zip = $_FILES['bin']['tmp_name'];
$location = 'test/';
echo 'zipok<br>';
echo ("size " . $_FILES['bin']['size']);
echo ("<br>");
echo ("type " . $_FILES['bin']['type']);
echo ("<br>");
echo ("error " . $_FILES['bin']['error']);
echo ("<br>");
echo ("tmp_name " . $_FILES['bin']['tmp_name']);
echo ("<br>");
echo ("name (client provided name) " . $_FILES['bin']['name']);
echo ("<br>");
} else {
echo "something wrong with the filename";
}
?>
Again special thanks to sstvmaster and GetMem for providing me with the means to get things working.