Image upload problems

images php coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
User avatar
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Fri Jun 27, 2003 10:00 pm

Your remote server cannot read a file on your local machine. You need to upload the file to the server first.

see for more info.

User avatar
New php-forum User
New php-forum User
Posts: 12
Joined: Sat Nov 29, 2003 9:58 am
Location: Oslo, Norway

Wed Mar 10, 2004 10:36 am

I really dont think any of that is going to get you anywhere, man...

to upload an image to the server use this code (or something similar):

Code: Select all

if(upload==TRUE) {

$targetfolder = $_SERVER['DOCUMENT_ROOT']."/your/folder/here/";
$targetfile = $targetfolder . $_FILES['imgfile']['name'];
// the lines gives you this string:
// your/server/root/your/folder/here/imgfile.gif
// no need to specify image type

move_uploaded_file($_FILES['imgfile']['tmp_name'], $targetfile);


You can use the $_FILES['imgfile'] variable to get info about filesize etc.:

Code: Select all

$size = $_FILES['imgfile']['size'];

then you could do something like this:

Code: Select all

strSQL = "Update tblimage Set imgtype='$imgtype', imglink='$imglink',imgdata='$targetfile' 
Where imgname='$imgname'";

just a suggestion. (*bangs head into desk realizing thread is 9 months old)

Post Reply