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
https://forums.phpfreaks.com/topic/110226-solved-upload-file-to-server/
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");

}

?>

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.