upload file from URL

This is a discussion on upload file from URL within the PHP Language forums, part of the PHP Programming Forums category; I have an input box for uploading image files <input type="file" name="userfile" size=&...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-04-2003
Geoff Berrow
 
Posts: n/a
Default upload file from URL

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/
Reply With Quote
  #2 (permalink)  
Old 11-04-2003
Alan Little
 
Posts: n/a
Default Re: upload file from URL

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/
Reply With Quote
  #3 (permalink)  
Old 11-04-2003
John Dunlop
 
Posts: n/a
Default Re: upload file from URL

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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:02 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0