Page 1 of 1

IMAGE UPLOAD HELP - I already read the Tutorinal

Posted: Thu Jun 08, 2006 2:57 pm
by jaccrock
Hi,

I'm working on a website where I need to upload digital camera pictures. I've been trying to follow the Tutorial for uploading and creating a thumbnail.

When I upload a test image of something small (7.14 KB), it works no problem.
When I uplaod a real image (2,116KB), I keep getting the following errors:

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Warning: unlink(): No such file or directory in /home/.ginko/jaccrock/jcstrategies.com/jeff/admin/featured_listings.php on line 105

Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/.ginko/jaccrock/jcstrategies.com/jeff/admin/featured_listings.php on line 107

Warning: imagesx(): supplied argument is not a valid Image resource in /home/.ginko/jaccrock/jcstrategies.com/jeff/admin/featured_listings.php on line 117

Warning: imagesy(): supplied argument is not a valid Image resource in /home/.ginko/jaccrock/jcstrategies.com/jeff/admin/featured_listings.php on line 117

Warning: imagesx(): supplied argument is not a valid Image resource in /home/.ginko/jaccrock/jcstrategies.com/jeff/admin/featured_listings.php on line 131

Warning: imagesy(): supplied argument is not a valid Image resource in /home/.ginko/jaccrock/jcstrategies.com/jeff/admin/featured_listings.php on line 132

Warning: imagecreatetruecolor(): Invalid image dimensions in /home/.ginko/jaccrock/jcstrategies.com/jeff/admin/featured_listings.php on line 134

Warning: imagesx(): supplied argument is not a valid Image resource in /home/.ginko/jaccrock/jcstrategies.com/jeff/admin/featured_listings.php on line 135

Warning: imagesy(): supplied argument is not a valid Image resource in /home/.ginko/jaccrock/jcstrategies.com/jeff/admin/featured_listings.php on line 135

Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/.ginko/jaccrock/jcstrategies.com/jeff/admin/featured_listings.php on line 135

Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/.ginko/jaccrock/jcstrategies.com/jeff/admin/featured_listings.php on line 136
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

From what I can tell, they seem to deal with the $_FILES['image']['tmp_name'] variable.

So I ran a print out of if and $_FILES['image']['tmp_name'] is empty / blank.

Like I said, when I use the smaller image, it prints out the name of the tmp file no problem. Any ideas how to get this working?

Thanks!

Posted: Thu Jun 08, 2006 3:04 pm
by PrObLeM
you may be over the max filesize for uploads. Generally the default is only 2mb. To fix it you'll have to edit the php.ini to allow bigger uploads.

Posted: Thu Jun 08, 2006 3:52 pm
by jaccrock
if i'm using a webhost service, is there anything I can do?

I was even wondering if there is a javascript function i could run before uploaded it to my webhost server?

Any more ideas? Thanks!

Posted: Thu Jun 08, 2006 3:54 pm
by PrObLeM
no, if you dont have access to the webserver then you're pretty much screwed.
you could try and zip the image and send it like hopefully it will be under 2 mb


and what do you mean by "I was even wondering if there is a javascript function i could run before uploaded it to my webhost server? "

Posted: Thu Jun 08, 2006 3:59 pm
by bdlang
PrObLeM wrote:no, if you dont have access to the webserver then you're pretty much screwed. you could try and zip the image and send it like hopefully it will be under 2 mb
Actually, you can do this via an .htaccess file, I've run into this before.
Obviously your host has to allow the use of an .htaccess file...

PHP Manual: php.ini directives
PHP Manual: upload_max_filesize
PHP Manual: How to change configuration settings

Posted: Thu Jun 08, 2006 4:15 pm
by jaccrock
The javascript question was relating to resizeing the image small enough so that it will upload before sending it to the server... I've never done it, i don't even konw if it's possible? Just trying to throw out ideas


bdlang,

You said you ran into this before? How did you fix it? What can i do to the .htaccess file?


Thanks!

Posted: Thu Jun 08, 2006 4:25 pm
by PrObLeM
jaccrock wrote:The javascript question was relating to resizeing the image small enough so that it will upload before sending it to the server... I've never done it, i don't even konw if it's possible? Just trying to throw out ideas
javascript cant resize the file.

Posted: Thu Jun 08, 2006 5:06 pm
by bdlang
jaccrock wrote: bdlang,

You said you ran into this before? How did you fix it? What can i do to the .htaccess file?
My post has links to all the information you'll need in the PHP manual.

Posted: Thu Jun 08, 2006 7:24 pm
by jaccrock
i can't even use ini_set(), so i don't think those links will work for me. (getting disappointed with my webhost). I can't believe more peole haven't had problem like this before???

Posted: Thu Jun 08, 2006 7:52 pm
by LiveFree
I dont know how to do this...

But is there a flag in the .htacess you can enable to change the value of php.ini settings?

Posted: Thu Jun 08, 2006 8:09 pm
by jaccrock
it doesn't seem like i can even access the .htaccess file! ughh

Posted: Thu Jun 08, 2006 8:10 pm
by bdlang
  • Read the links I reference in my original post.
  • In your web root directory, create a file named .htaccess (note the '.')
  • The file should contain these lines:

    Code: Select all

    php_value upload_max_filesize 20971520
        php_value post_max_size 22020096
    (or whatever max file size you want)
  • Save the file
  • Don't forget to change the value of MAX_FILE_SIZE in your form.
  • Check your file upload script
Google search: .htaccess PHP

Posted: Thu Jun 08, 2006 8:29 pm
by jaccrock
THANK YOU! I (obviously) have limited experience with webhosts and I really appreciate the help! It WORKS