Jump to content

[SOLVED] upload file to server


telsiin

Recommended Posts

 

Good Afternoon everyone

 

 

I have a bit of code I am having some problem with, to upload a pic to a server.

Now the code appear to be working but when I check the folder the test image is not there/saved on the server 

 

 

thank you all in advance

Antonio

 

<?php

if($_FILES[map1] !=" "){

@copy($_FILES[map1][tmp_name],

"C:\lordsofansalon\htdocs\DM\mapsrc\".$_FILES[map1][name])

or die("Couldn't copy file please make sure it a jpg and under 2 megs.");

}

else

{

die("No Input file specified");

}

?>

Link to comment
Share on other sites

I also get the following  confirmation message

You Sent :boardmap1.jpg a 75930 byte file with a mine type of image/pjpeg.

 

however I notice the extension is pjpeg and NOT jpeg or jpg

 

 

<?php

if($_FILES[map1] !=" "){

$destination="C:\lordsofansalon\htdocs\DM\mapsrc".$_FILES[map1][name];

$temp=$_FILES[map1][name];

move_upload_file($temp,$destination);

or die("Couldn't copy file please make sure it a jpg and under 2 megs.");

}

else

{

die("No Input file specified");

}

?>

Link to comment
Share on other sites

I also get the following  confirmation message

You Sent :boardmap1.jpg a 75930 byte file with a mine type of image/pjpeg.

 

however I notice the extension is pjpeg and NOT jpeg or jpg

 

 

<?php

if($_FILES[map1] !=" "){

$destination="C:\lordsofansalon\htdocs\DM\mapsrc".$_FILES[map1][name];

$temp=$_FILES[map1][name];

move_upload_file($temp,$destination);

or die("Couldn't copy file please make sure it a jpg and under 2 megs.");

}

else

{

die("No Input file specified");

}

?>

 

Read what the message says.  pjpeg is the MIME TYPE, not the file extension.  IE, being the quirky, Microsoft-made cess pool it is, sends out the Mime Type as pjpeg for jpegs instead of what the other browsers send it out as.  And don't trust browser Mime Types.  You can alter them if you know what you're doing. =P

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.