Re: Help figuring out an uploading script problem...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2009-03-30 at 11:44 -0500, Terion Miller wrote:
> I have this script that is no longer working to upload files, it goes thru
> the motions and says the file is uploaded but then there is NO file in the
> ArtWork folder....
> 
> any ideas?
>     if ($_FILES) {
>         for ($x=0; $x < 15; $x++) {
>             if (is_uploaded_file ($_FILES['Artwork']['tmp_name'][$x])) {
>                 $ImageExt = strtolower(end(explode('.',
> $_FILES['Artwork']['name'][$x])));
>                 $ImageName = $_FILES['Artwork']['name'][$x];
>                 $ImageSize = $_FILES['Artwork']['size'][$x];
>                 list($width, $height, $type, $attr) =
> getimagesize($_FILES['Artwork']['tmp_name'][$x]);
> 
>                 $sql = "INSERT INTO images (ImageDate, ArtID, AdminID,
> ImageName, ImageType, ImageType2, ImageSize, ImageHeight, ";
>                 $sql .= "ImageWidth, ImageAttr, Notes) VALUES (NOW(),
> '$ArtID', '$AdminID', '$ImageName', '$ImageExt',";
>                 $sql .= " '$type', '$ImageSize', '$height', '$width',
> '$attr', '$Notes2')";
>                 mysql_query ($sql);
>                 $ImageID = mysql_insert_id();
> 
>                 $uploadfile = "../../Artwork/". $ArtID ."_". $ImageID .".".
> $ImageExt;
>                 move_uploaded_file($_FILES['Artwork']['tmp_name'][$x],
> $uploadfile);
>                 chmod($uploadfile, 0666);
>             }
>         }
>     }
> 
> Thanks
> Terion
> 
> Happy Freecycling
> Free the List !!
> www.freecycle.org
> Over Moderation of Freecycle List Prevents Post Timeliness.
> Report Moderator Abuse Here:
> http://www.freecycle.org/faq/faq/contact-info
> Or Email Your Complaint to:
> faq@xxxxxxxxxxxxx or info@xxxxxxxxxxxxx
> ------------------------------------------------
> Twitter?
> http://twitter.com/terionmiller
> ------------------------------------------------
> Facebook:
> <a href="http://www.facebook.com/people/Terion-Miller/1542024891";
> title="Terion Miller's Facebook profile" target=_TOP><img src="
> http://badge.facebook.com/badge/1542024891.237.919247960.png"; border=0
> alt="Terion Miller's Facebook profile"></a>

Well, there are many reasons this could fail, but you need to diagnose
what is the actual problem. First, is it no longer working at all, or
after a certain number of files are uploaded? I see you are trying to
upload up to 15 files this way, are you sure that the combined file size
is not greater than what your PHP setup can handle for a single post?

Are the database inserts being performed correctly? If not, then PHP may
be having problems seeing the uploaded files. Are there any error
messages from this piece of code? Does the location to where you are
attempting to move the files exist, and if so, does it have the correct
permissions? Is there enough space on the drive/partition you are trying
to move the files to?

Lastly, the snippet of code you gave does not show where $ArtID was
defined. Can you print out the query to see what it is actually doing?


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux