Jump to content


Photo

Uploading problem


  • Please log in to reply
8 replies to this topic

#1 hadoob024

hadoob024
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 30 March 2006 - 08:49 PM

I've seen this issue posted a thousand times, but everyone else seems to have issues with the uploading part. My problem is with the displaying part. I read through the PHP manual about this, but it didn't answer my question.

When I process an uploaded file, do I have to move or copy it prior to displaying it? I'm not interested in saving the file right now. I just want to verify that it was uploaded properly by displaying it. Here's my code for displaying the uploaded image file.

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 30 March 2006 - 08:53 PM

EDIT: OK he has just edited post which is better then what ever got posted before.

Also can you edit your title too so it makes sense!

I will unlock the topic too!

#3 hadoob024

hadoob024
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 30 March 2006 - 08:55 PM

sorry. i'm having problems with new posts and editing prior ones. i keep getting this "403 Forbidden from editing index.php" error message.

where can you edit the topic?

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 30 March 2006 - 08:58 PM

This is due to a security script that is installed and causes this in certian cases. It thinks your attacking server with your PHP code. for now could place your code over at [a href=\"http://pastebin.com/\" target=\"_blank\"]Paste Bin[/a] and provide a link to you code.

EDIT: I have edited your thread title as sadfasddf didn't make much sense!

#5 hadoob024

hadoob024
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 30 March 2006 - 09:01 PM

Cool. Thanks for the tip. I couldn't figure out why it wouldn't let me include my code. Anyway, the code for what I'm doing is located at:

[a href=\"http://pastebin.com/631485\" target=\"_blank\"]http://pastebin.com/631485[/a]

However, all this ends up displaying is garbage like the following:
"ÿØÿàJFIFddÿìDuckyPÿî&AdobedÀ MÍ„IÇü¢ÿÛ„      ÿÂÿÄ  0@P`1!"2#%345&p°$A!1Aq"Qa?‘2# 0@P¡ÑBRr‚’34`±ÁbC$Sƒ5ðáñcD%¢²s“Tdt°Â³Eu1!P`2 0@pA"Qa€?Àq‘±B ¡b1!AQaq@P?‘¡± 0`ÁÑðáñp°ÿÚ …üÿhðR˜ð?‡´û*Äý|>€†&ÙÑÓÞøîwÏmµ69®YÅĬa?Nœ˜¾¶Ö«¥*i¯Ól¦{o½~lÉ|´Zk söä3Üao–ã¿&÷lðµ¼e—NS.Œ]©{·,á¯4í|å‚ø!Â-63tŽ•PN\$BaCdpz.g;SM›¿3žþ€Äk‡õù’àȼ•k%ƒ|˜r^ÖNK¦°'/£‘¦€P˜Ÿ;|žÏµ©‘Ñ ç’{.ÀÅ€°8øêà&,×ÍHÕ!ªÅµZßU®š]tÖ©®G=²` #¯ÍïÍyÀ?Έ`HPêƒØq¹ÔFXbˆˆ‚sÚ÷'–à¯;ôn`›Î?Bçä?H>“ç*›¦€=ïÉúiÓÁzæÓ¤€š‡'îrß7x&ÍÕç÷nÜ»˜± £ÅŸŠæ¾]ź'ƒØ¨øo½Þ÷D{ôž{ÍâÊse†ìèõÝèÝÅ€f:8K:8ÀŠ¤[ôO®7_–ùÜ>óofO(Ù¹#tá¯;ý.²7™[{1Úί×3çÎçû7û ÐßT˾-6^ZÅÞµäo2°Öz½PñÕçþ†mÊüL5` êÛ¢¸}€6|?Íæ0ˆëÓ¼?æSXë´Oì^@ói¿ùÕ%Ï¿Iª§Ïç‘Î5¾©Òû*R§‘L^³c¢ÃIŽýmµ?Ù¾*®¢ÞÀ%N¿7¼5ç~-@J·èn\t7À|ÐŽý;är?+¾Ûÿ›]S²d.±?*mw¦Ó'‰ž‹èZSò(4OBÛן]'¾Ù¾xÊeç·¤•åÒ ú©û×L—ÂßL}µôÓ)[tæù÷Mêü"0 í5žø½P¹üÇÎÝæÄí:wlÌÞH ôk¿säL>Ç£Ôw°~RœúlÙï9qú`HŸ$?ú5?9ò|(JÚÓ3z¾‡WÞÀÌGæ1òú;®= HŸ$?z6?¹ñæT&m%e3?µ*-ktÒ_ÔYõûE½EýVõâ×”™ÓÙåëݪOÇÒ+ Å4Ÿ8½j€±ð|Ì&¤kzßcÊ>žÅýE‘QuµÅmy[_Rr›ÚÍÕf©ôør÷ø»«0yù6[€îg'§´ç¸Oñ¹‡Óà>Ÿ¢$¡î³ö¢kVvÏs‹¾=Np@G AS=¤œ;vÌ·™ðq«UjÍjÍÍfâ“sY¾Î×›šÍÅfµfµ^҇В÷ÓyÝ×ô|…é¤AÅë{Š3ÊÛÌQ˜ñåKð}À>À|•)‹kE?ãJ÷¸¿F¾—ÏøœâxÃ?ÔËÓP H·˜µšÛLQVœBh¯œÜæ*I¹ÍV“qš½&ë9¼Îo3¶G;^gkÊMÝ&â³}Xöä*íÖ‹+gxÇi[ ka¥m/ÚVÞÑozÛ^(^-oZ‹kÇ™„ª–{WõÏ»€“”by›Ðº¦–ÊÓˆ÷EÎsw’ã9¸Ên²\ç7™ÎGd³¶G+ßçkªMÅgÐÀ"o‚Þñmx¡zÚÞ(^-¯Z‹m ?²« ¥ÄMÅf´*@‚Ö¿¨>¯>ÔmKó:tß·7ϦkžùÒ}¬*Öné75µÝ&î–«€ õÞ8>åBbÞËi‰¿¿üÚ ÔâsŒMLÓr÷;GŸžû÷??>»Ç"


Any thoughts on what's going on? thanks!

#6 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 30 March 2006 - 09:07 PM

Instead of echo'ing you $contents file like so:
echo '<B>Picture:</B><BR />'.$contents;
try doing like so:
header('Content-type: image/jpeg');
echo $contents;


#7 hadoob024

hadoob024
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 30 March 2006 - 09:18 PM

hmmm... that might work, but i know that i've already sent some html as output, so i'm guessing that i will end up getting one of those "cannot modify header" error messages. think there's anything else i can try?

#8 hadoob024

hadoob024
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 31 March 2006 - 06:37 PM

OK. So it's looking like I can't just take the uploaded image and display it. It seems like I have to move it to a temp directory and then I can display it. Anyway, I just modified my file upload script. Everything works fine until the following. I first specify a pathname to a directory that I created called "uploadtmp" which resides in my public HTML folder:

$picpath = '/home/virtual/site109/fst/var/www/html/uploadtmp/'.$_FILES['picture']['name'];


I then move the file to this location using the following:

if (!move_uploaded_file($_FILES['picture']['tmp_name'], $picpath))


However, this command gives me the following error message:

"Error Message:
move_uploaded_file(/home/virtual/site109/fst/var/www/html/uploadtmp/akira01.jpg):
failed to open stream: Permission denied
Error Code: 2"

What is causing this permissions error? Thanks.

#9 hadoob024

hadoob024
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 01 April 2006 - 04:58 AM

OK. I seemed to have gotten past the permissions error. I changed the permissions of that folder and now I'm not getting those errors anymore. I'm still getting jumbled up garbage when I try to display the image though. Here's the code:

[a href=\"http://pastebin.com/633809\" target=\"_blank\"]http://pastebin.com/633809[/a]

Any thoughts on why the image isn't being displayed?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users