General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 16th, 2003, 10:54 AM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 6
Send a message via AIM to jben.net
file upload mac os x fine, windows xp not ???

Hi,

I've written a simple CMS for a site I'm working on and I thought everything was working ok until I tested it on a pc.

I always get the same error on the pc which is something I wrote so that only normal jpg's would be uploaded, not progressive jpgs (this is because the site has a flash front end and flash can't load in progressive jpg's dynamically).

I added some more error checking in the php file, and a very strange thing is occuring. I have tried uploading the EXACT same jpg from both my mac and pc, on the mac it uploads fine, resizes etc etc but on the pc it doesn't and in my error message it says that the file is a 'image/pjpeg' ???? Does a pc think a normal jpg is a prgressive jpg ??? How can the jpg change file types ???? this is really weird!

If you need any more info please just ask.

Thanks,

Jon

Reply With Quote
  #2  
Old April 9th, 2004, 10:02 PM
kevincho kevincho is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 kevincho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have uncovered the opposite problem. I have a jpg file that works in PC but not on Mac. I'm checking the upload filetype to "image/pjpeg" and works fine on PC. However, when a user uploads it from Mac, it fails. I don't have access to Mac so I don't know what typetype PHP thinks it is uploading. Hmm...

Reply With Quote
  #3  
Old April 10th, 2004, 12:51 PM
Pheifel Pheifel is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Denmark
Posts: 174 Pheifel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 46 sec
Reputation Power: 5
Send a message via MSN to Pheifel
This scipt will upload both in PC and MAC



PHP Code:
<? 
?>
 
 
<form name ="form1" method ="post" action ="" enctype ="multipart/form-data" >
<p> fil : 
    <input type ="file" name ="imagefile">
    <input type="hidden" name="MAX_FILE_SIZE" value="100000000">
</p>
<p>navn på billedet: 
    <input name="navn" type="text" id="navn">
</p>
<p> type: 
    <select name="type" id="type">
     <? $userFetch mysql_query("SELECT * FROM USER_cat");
while(
$cat=mysql_fetch_array($userFetch)) {
 
print 
"<option value='$cat[id]'>$cat[besk]</option>";
 
?>
    </select>
</p>
<p>beskrivelse af billedet: 
    <textarea name="beskrivelse" cols="40" rows="5" id="beskrivelse"></textarea>
</p>
<p> 
    <input type ="submit" name ="Submit" value ="Submit" >
    <?
 
if ($imagefile && $type && $beskrivelse && $navn) {
$SAT mysql_fetch_array(mysql_query("SELECT * FROM USER_uploads ORDER BY id DESC LIMIT 1"));
if (
$SAT[id] > 0) {$sat $SAT[id] + 1;}
else {
$sat 1;};
 
//tjekking for jpg/gif etc...
if ( $_FILES ['imagefile' ][ 'type' ] == "image/gif" || $_FILES ['imagefile' ][ 'type' ] == "image/jpg" || 
     
$_FILES ['imagefile' ][ 'type' ] == "image/pjpeg" ||    $_FILES ['imagefile' ][ 'type' ] == "image/jpeg" || 
$_FILES ['imagefile' ][ 'type' ] == "image/png"){ 
 
copy ($_FILES['imagefile']['tmp_name'], "uploads/tegninger/".$USERID."_".$sat.".jpg") or die ( "Error" );
 
echo 
"<br>Transfer complete" ;
} else {print 
"Error";}
} else {
 
//tjekking for PSD type
if ($_FILES['imagefile']['type'] == "application/x-photoshop") {
 
copy ($_FILES['imagefile']['tmp_name'], "uploads/tegninger/".$USERID."_".$sat.".psd") or die ( "Kunne ikke kopiere" );
 
mysql_query("INSERT INTO USER_uploads (id , navn , beskrivelse , userid , type , time , clicks , ext) VALUES ('','$navn','$beskrivelse','$USERID','$type','NOW ( )','0','psd')");
 
echo 
"<br>Vi har modtaget din tegning, og den er i dit galleri" ;
echo 
"<br>Navn: $navn""" ;
echo 
"<br>Størrelse: " .$_FILES ['imagefile' ][ 'size' ]. "kB" ;
echo 
"<br>Type: " .$_FILES ['imagefile' ][ 'type' ]. "" ;
echo 
"<br>Overførslen er komplet" ;
} else {
echo 
"Forkert filtype: " .$_FILES['imagefile']['type']. " filen kunne ikke kopieres"
}
}
}
//$uploaddir = 'uploads/profil/validate/';
//$uploadfile = $uploaddir. $_FILES['userfile']['name'];
//$uploadfile = 'uploads/profil/validate/'.$USERID.'_validate.jpg';
//move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile);
//print "<h1>Overførslen Komplet</h1>hej $uploadfile";
//if (!file_exists("uploads/profil/validate/".$USERID."_validate.jpg")) { print "<h2>Error</h2> }
 
?>
</p>
</form>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > file upload mac os x fine, windows xp not ???


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT