Jump to content


Photo

How to reUpload an image?


  • Please log in to reply
9 replies to this topic

#1 mlnn

mlnn
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 28 February 2006 - 04:46 PM

HI

i am trying to build a uploading system.

What shuold i do for the reUpload image? {one host to another, not from comp to my host}
Like:
[a href=\"http://www.imageshack.us/\" target=\"_blank\"]http://www.imageshack.us/[/a]


What function to use?


thanks :)

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 28 February 2006 - 05:46 PM

I don't think I understand the question. If you want to move files from one host to another, use something like [a href=\"http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html\" target=\"_blank\"]PuTTY[/a] as the Telnet/SSH client. If - as imageshack does - you want to upload files from your computer (or your site users want to), then use a simple image uploader such as [a href=\"http://fundisom.com/phparadise/php/image_handling/image_upload_and_resize\" target=\"_blank\"]LixlPixel's excellent free script[/a].
Legend has it that reading the manual never killed anyone.
My site

#3 mlnn

mlnn
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 28 February 2006 - 06:12 PM

[!--quoteo(post=350295:date=Feb 28 2006, 12:46 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Feb 28 2006, 12:46 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I don't think I understand the question. If you want to move files from one host to another, use something like [a href=\"http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html\" target=\"_blank\"]PuTTY[/a] as the Telnet/SSH client. If - as imageshack does - you want to upload files from your computer (or your site users want to), then use a simple image uploader such as [a href=\"http://fundisom.com/phparadise/php/image_handling/image_upload_and_resize\" target=\"_blank\"]LixlPixel's excellent free script[/a].
[/quote]

well, you right. you didnt understand me :)

i am BUILDING an uploading system.

If i want to upload a file from my computer to the host, i use:
move_uploaded_file

and IT WORKS!


But what i need to do if i want to ReHost the image?
what function to use?
lets say, i have:

image.com/logo.jpg

and i want to upload to the server, directly, not downloading it to my computer and the uploading....

imageshack have this option (url upload).


i hope now you understand me :)

#4 litebearer

litebearer
  • Members
  • PipPipPip
  • Advanced Member
  • 2,357 posts
  • Locationwhite lake michigan

Posted 28 February 2006 - 08:31 PM

Read through the examples and suggestions here...

[a href=\"http://us3.php.net/ftp\" target=\"_blank\"]http://us3.php.net/ftp[/a]

Lite...

all the brothers were valiant!

[br][br]The truely intelligent people are not those who create the dots; rather they are they ones with the ability to connect the dots into a coherent picture

#5 radius

radius
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 28 February 2006 - 08:44 PM

hum, if there's no embedded function you can simply save the remote stuff using some fopen or other function with the url

#6 XenoPhage

XenoPhage
  • Members
  • PipPipPip
  • Advanced Member
  • 99 posts

Posted 28 February 2006 - 08:53 PM

It sounds like imageshack is merely taking the supplied URL and downloading the file directly. Nothing fancy there.. Although I suspect they would check file size first..
--
[a href=\"http://blog.godshell.com\" target=\"_blank\"]XenoPhage[/a]
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Something mysterious is formed, born in the silent void. Waiting alone and unmoving, it is at once still and yet in constant motion. It is the source of all programs. I do not know its name, so I will call it the Tao of Programming.[/quote]

#7 mlnn

mlnn
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 28 February 2006 - 09:10 PM

well, thanks but most of you are wrong =\

i managed to do what i want with the function COPY.
Yes :)

now there are only two problems:

1. how to check the file size?
2. how to get the name of the file? because i get: [a href=\"http://domain.com/file123.ext\" target=\"_blank\"]http://domain.com/file123.ext[/a] (the extention i also managed to get so i only have: [a href=\"http://domain.com/file123\" target=\"_blank\"]http://domain.com/file123[/a] ). how is it possible to get only the name of the file? (file123)?

thanks.

#8 markduce

markduce
  • Members
  • PipPip
  • Member
  • 22 posts

Posted 28 February 2006 - 09:18 PM

I have been away for a bit, but I would suggest that you use smarter language when replying, because those people that replied to you were certainly not wrong.

#9 XenoPhage

XenoPhage
  • Members
  • PipPipPip
  • Advanced Member
  • 99 posts

Posted 28 February 2006 - 09:21 PM

[!--quoteo(post=350364:date=Feb 28 2006, 04:10 PM:name=mlnn)--][div class=\'quotetop\']QUOTE(mlnn @ Feb 28 2006, 04:10 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
2. how to get the name of the file? because i get: [a href=\"http://domain.com/file123.ext\" target=\"_blank\"]http://domain.com/file123.ext[/a] (the extention i also managed to get so i only have: [a href=\"http://domain.com/file123\" target=\"_blank\"]http://domain.com/file123[/a] ). how is it possible to get only the name of the file? (file123)?
[/quote]

Hrm.. how about some regex wizardry?

preg_match('/^http:\/\/(?:.*\/)(.*)$/', $url, $matches);

$matches should have the filename..

Or, if you strip off the htttp://, you can use basename() to get the filename...
--
[a href=\"http://blog.godshell.com\" target=\"_blank\"]XenoPhage[/a]
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Something mysterious is formed, born in the silent void. Waiting alone and unmoving, it is at once still and yet in constant motion. It is the source of all programs. I do not know its name, so I will call it the Tao of Programming.[/quote]

#10 mlnn

mlnn
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 01 March 2006 - 06:16 PM

markduce - WTF oO

YAY i dont it :)

thanks everyone :)


$file_type=substr($file,strrpos($file,'.')+1); 
$file_name=pathinfo($file);
$file_name=$file_name['basename'];
$file_name=substr($file_name,0,strrpos($file_name,'.')); 







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users