file upload- Can you give URL as source image instead of path to image? |
[eluser]Unknown[/eluser]
Hi guys, In my CMS I mostly upload images that are already on the Web. It would be useful if I could give them to my upload form directly via URL. Currently, I have to download tham to computer and than upload them to the form (code bellow). The part echo form_upload('userfile'); handles the upload but can't manage the URL. I use library('upload'), and this is what my form looks like: Code: echo form_open_multipart('admin/upload'); All the best, Gregor
[eluser]davidbehler[/eluser]
What you could do is this: - remove the upload field - add a new input field called "url" or whatever you want where you enter the url of the file you want to upload to your server - after submitting the form you take the value from the url input field and let the server download the file, e.g. using file_get_contents() or fopen()
[eluser]Unknown[/eluser]
[quote author="waldmeister" date="1282752436"]What you could do is this: - remove the upload field - add a new input field called "url" or whatever you want where you enter the url of the file you want to upload to your server - after submitting the form you take the value from the url input field and let the server download the file, e.g. using file_get_contents() or fopen()[/quote] Thanks waldmester fot the idea. However, file_get_contents only puts image into string and fopen does simmilar. So I need something more to save the image to the server. I found the simple solution for that: Code: $url = 'http://example.com/image.jpg'; |
Welcome Guest, Not a member yet? Register Sign In |