By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,047 Members | 1,257 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,047 IT Pros & Developers. It's quick & easy.

upload file from URL

P: n/a
I have an input box for uploading image files

<input type="file" name="userfile" size="35" >

This works upload from my machine, but if I paste in a URL, the
following:

if (($_FILES['userfile']['type']=="image/gif") ||
($_FILES['userfile']['type'])=="image/pjpeg" ||
($_FILES['userfile']['type']=="image/jpeg"))

returns false even if the file is a .gif or a .jpg.

How do I upload pics from a URL?
--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Carved in mystic runes upon the very living rock, the last words of Geoff
Berrow of comp.lang.php make plain:
How do I upload pics from a URL?


You don't upload files from a URL. You upload files from your computer. If
you want to open a URL, ensure that allow_url_fopen is set to true in your
config, and use fopen():

http://www.php.net/manual/en/function.fopen.php

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
Jul 17 '05 #2

P: n/a
Geoff Berrow wrote:
I have an input box for uploading image files
Although probably much improved, browser support for file uploads
is (still?) not universal. So consider offering users alternative
methods to transfer the data.
How do I upload pics from a URL?


RFC2388 sec. 5.7 outlines one possible way of referencing data at
an URL:

| In some scenarios, the user operating the client software might
| want to specify a URL for remote data rather than a local file.
| In this case, is there a way to allow the browser to send to the
| client a pointer to the external data rather than the entire
| contents? This capability could be implemented, for example, by
| having the client send to the server data of type
| "message/external-body" with "access-type" set to, say, "uri",
| and the URL of the remote data in the body of the message.

http://www.ietf.org/rfc/rfc2388.txt

But current browser support is unsurprisingly nonexistent, to my
knowledge. Does anyone know a browser that implements this?

The intention of the HTML specification is that users are able to
choose a file from their local filesystem. Browsers usually offer
the user the option of browsing their filesystem to pick out a
file, but I can't see any reason why a user cannot enter a full
local pathname directly, such as "C:\temp\image.png" [1].
[1] I was going to type ".jpg", but you've seen this, right? ;-)
http://siliconvalley.internet.com/ne...le.php/1429861

--
Jock
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.