Jump to content

Archived

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

hadoob024

Uploading problem

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
Instead of echo'ing you $contents file like so:
[code]echo '<B>Picture:</B><BR />'.$contents;[/code] try doing like so:
[code]header('Content-type: image/jpeg');
echo $contents;[/code]

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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:

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


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

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


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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

×

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.