Uploading to webhost Uploading to webhost
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Uploading to webhost

Started by yoggieb, July 14, 2005, 03:36:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

yoggieb

Hi guys,

I kept getting the 0 uploads successful error whenever i try to upload a file. I tried everything on the FAQ provided. Then I realised that it is my server config that prevents me to upload because another installation of coppermine in another directory is also having the same problem. This installation should not have this problem because I was able to upload photos in the past. No settings was changed for that directory. Since both old and new installations are not working. I suspect it is a server configuration that prevents me from uploading stuff to it.

I am co-administrating this server. Can someone please let me know what do i need to enable in order for my server to allow uploads? Is it a port issue? Thanks in advance.

Joachim Müller


yoggieb

#2
Hi,

I have set up the environment according to the troubleshooting guide. UserID = tester, password =12345.

My site is at *
Thanks for your help.

Joachim Müller

This is the error message I get
QuoteNo file was uploaded !

If you have really selected a file to upload, check that the server allows file uploads...

File: d:\Web\cca\motor\gallery\db_input.php - Line: 222
Contact your webhost for support: ask them if you're allowed to make http uploads

yoggieb

#4
Hi,

Thanks for the reply. I am the administrator of this machine. However, I am not the system administrator for the network that this machine is on. Is there anything I can do on the web machince to enable HTTP Uploads? Is there a port that I need to open?

I have verified the following "If you get the error message No picture was uploaded. If you have really selected a picture to upload, check that the server allows file uploads..., check if there's a problem with HTTP uploads on your server - they may have been disabled or improperly configured. In phpinfo(), check that "file_uploads" is ON, "upload_max_filesize" is something like 2M and "upload_tmp_dir" is a valid directory!" based on the FAQ provided.

Is there anything else I can do?

Joachim Müller

this is not related to network setup, but server setup (apache and php configuration), so you should be able to fix this by yourself, as you're administering the webserver. Also make sure that CHMOD settings are correct.

yoggieb

I am using IIS 4 and php 4.4.0. I tried checking the php.ini file and everything is in order. The CHMOD settings are also correct because I have deployed coppermine in another server with the same settings and it works. So I have no more ideas on what I can do. Is there anything I need to do on IIS to enable http uploads?

kegobeer

Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

kegobeer

#8
Something else:

Go here: http://www.onlamp.com/pub/a/php/2003/04/24/php_foundations.html

That gives a basic overview on http uploads.  Try this code (change $path to a writable directory).  The html file can be called anything, name the php file uploadproc.php.

<html>
<head></head>
<body>
<form method="post" action="uploadproc.php" enctype="multipart/form-data">
<input type="file" name="myfile"><br />
<input type="submit" value="Upload File">
</form>
</body>
</html>

<?php
// Change $path to a writable directory
// Either as a path (/www/home/gooddir/)
// or as a relative path (gooddir/)
$path "tmp/";

// Nothing to change below this line.
$errmsg = array('0' => 'No errors',
                
'1' => 'The uploaded file exceeds the upload_max_filesize directive in php.ini.',
                
'2' => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.',
                
'3' => 'The uploaded file was only partially uploaded.',
                
'4' => 'No file was uploaded.',
                
'6' => 'Missing a temporary folder.');
if(!isset(
$_FILES['myfile'])) {
die (
"Error! The expected file wasn't a part of the submitted form");
}

if(
$_FILES['myfile']['error'] != UPLOAD_ERR_OK) {
echo 
'Error ' $_FILES['myfile']['error'] . ', ' $errmsg[$_FILES['myfile']['error']] . '<br>';
echo 
"Error! The file uploaded failed.";
die();
}

if(!
move_uploaded_file($_FILES['myfile']['tmp_name'],
   
$path $_FILES['myfile']['name'])) {
die (
"Error! Moving the uploaded file failed.");
}

echo 
"File successfully uploaded.";
?>


That should give you a more detailed output for your failure.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

yoggieb

Hi,

Thanks for your advise. I tried the script that you gave me and got the following error. I don't know PHP, so I hope you could explain to me.

PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0 PHP Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in d:\home\allen\uploadproc.php on line 3

kegobeer

Change

die "Error! The expected file wasn't a part of the submitted form";

to

die ("Error! The expected file wasn't a part of the submitted form");

Try the script again.  However, it looks like you don't have write permissions to whatever tmp directory you have, but we'll know more when you report your results.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

yoggieb

I got the following error now. I have checked my security settings. I have allowed IUSR_COMPUTERNAME with write access to both "albums" and "include" folders. Is there anything else I can do or any other settings that I can set? Thanks for your help.

6
Error! The file uploaded failed.PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0


kegobeer

You don't have permission to write to whatever tmp directory is specified in your php.ini file.  If you are using the default tmp directory, then you are using the Windows temp directory, which you don't have access to.  You can specify any directory as the tmp directory - make a directory in your document root and give it read/write access for the IUSR account, then update your php.ini file accordingly.

I suggest you search Google for IIS setup, and review GauGau's guide on setting up servers.  Although we try to help fix faulty server setups, it really isn't our speciality.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

yoggieb

Hi,

Thanks for all your help. You have enlighten me in a certain way. I recently upgraded my php version to 4.4.0 and a temp directory was not created for me. After creating the temp dir, i was able to upload the file. Then I had a placement error. I checked my security settings for albums and include and found that it had both allow and deny access for write rights. Since deny right takes precedence, i had to remove it. After that everything worked out fine.

Thanks for all your help. I have listed the things that I did for reference so that other might be able to benefit from it.