473,395 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

uploading files without a form

can anyone point me to some straightforward information on
file uploading without using an html form? That is, direcly from
within a php script.

if I know the local path etc. to a particular requested file how can I send
it
directly to a location on a remote webserver following
a request from the remote server?

The motivation is that I have a large number of image files that are
infrequently requested
but need to be available in full-weight format (2meg+ size) as and when
required from a website.
I don't really want to store the full size fles online as it would be quite
a few gigabytes, just a preview size.
is all that's needed. Local storage is very inexpensive and easier to
maintain!

When a file is requested, I simply want the webserver to call my local
server
and get it to upload the requested file (or files ) to the webserver to be
picked up by the user.

cant seem to get a handle on this - all the info on uploading
seems to be about uploading from a form. Any pointers would be appreciated.





Jul 17 '05 #1
6 2798
*** Chamomile escribió/wrote (Sun, 6 Mar 2005 17:18:54 +0000 (UTC)):
When a file is requested, I simply want the webserver to call my local
server and get it to upload the requested file (or files ) to the webserver to be
picked up by the user.


I think your function is readfile(). Manual says: "You can use a URL as a
filename with this function if the fopen wrappers have been enabled."
--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Manda tus dudas al grupo, no a mi buzón
-+ Send your questions to the group, not to my mailbox
--
Jul 17 '05 #2

"Alvaro G. Vicario" <kA*****************@terra.es> wrote in message
news:1m******************************@40tude.net.. .
*** Chamomile escribió/wrote (Sun, 6 Mar 2005 17:18:54 +0000 (UTC)):
When a file is requested, I simply want the webserver to call my local
server and get it to upload the requested file (or files ) to the
webserver to be
picked up by the user.


I think your function is readfile(). Manual says: "You can use a URL as a
filename with this function if the fopen wrappers have been enabled."


yabut, I don't he needs even that. Cant you simply link to your local file?
(also, you wont be getting charged against your monthly hosting bandwidth)
<a href="http://your.ip.if.its.static/dir/file.ext">click here</a>
you do, of course need to be running a web server or ftp server on your
local box.
<a href="ftp://username:pa******@your.ip.if.its.static/dir/file.ext">click
here</a>

you can even make the file list links dynamically if you're running php on
your local server by including a file.php that is on your local server which
lists out the files.
include "http://your.ip.if.its.static/lister.php"; your local server will
run this locally. see
<
http://groups-beta.google.com/group/...cd7e036de7d5ed >

--
hth
juglesh
Jul 17 '05 #3
NC
Chamomile wrote:

can anyone point me to some straightforward information on
file uploading without using an html form? That is, direcly from
within a php script.
Sure. Let's say your local server is called local.com and your
remote server is remote.com. Then remote.com can simply copy
your local files for temporary storage:

copy('http://local.com/localpath/locaimage.ipg',
'/remotepath/remoteimage.jpg');

Obviously, you will need to run a preiodic cleanup on the
remote server...
cant seem to get a handle on this - all the info on uploading
seems to be about uploading from a form.


You don't need uploading. Simple copying would suffice.

Cheers,
NC

Jul 17 '05 #4

">
You don't need uploading. Simple copying would suffice.

Cheers,
NC


Thanks for that - I'll give it a go!
As the Great Lord Buckley said:
'It was so simple, it eluded me...'
Jul 17 '05 #5
> > You don't need uploading. Simple copying would suffice.

Cheers,

Thanks for that - I'll give it a go!

spoke too soon.
couldnt get it to work - error message:

'failed to open stream: HTTP wrapper does not support writeable connections.
'

when I check the php info the 'allow_url_fopen' is set to 'on' ...on the
remote server (with the script running there)
on my local server the allow_url_fopen is set to 'on' but appears as 1 in
phpinfo.(not'on')
(i've tried running the copy() function locally and on the remote server -
in fact i am now so confused i dont know where it should be run)

if i run copy() locally i can copy a file around the pc anywhere i like, but
as soon as i use a web url it fails.
i think maybe the local version of php is too old (unsupported use of urls
in copy()?) so I try to
upgrade local php (4.2.2) to 4.3.1 which is what my web host server runs.
can i do that? no.
a whole day wasted trying to upgrade php on the off-chance that's the
problem.
i've posted an sos on that now!
yergh


Jul 17 '05 #6
Chamomile wrote:
You don't need uploading. Simple copying would suffice.

Cheers,

Thanks for that - I'll give it a go!

spoke too soon.
couldnt get it to work - error message:

'failed to open stream: HTTP wrapper does not support writeable
connections. '

when I check the php info the 'allow_url_fopen' is set to 'on' ...on
the remote server (with the script running there)
on my local server the allow_url_fopen is set to 'on' but appears as
1 in phpinfo.(not'on')
(i've tried running the copy() function locally and on the remote
server - in fact i am now so confused i dont know where it should be
run)

if i run copy() locally i can copy a file around the pc anywhere i
like, but as soon as i use a web url it fails.
i think maybe the local version of php is too old (unsupported use of
urls in copy()?) so I try to
upgrade local php (4.2.2) to 4.3.1 which is what my web host server
runs. can i do that? no.
a whole day wasted trying to upgrade php on the off-chance that's the
problem.
i've posted an sos on that now!
yergh


The copy command should run on the webserver. Use a URL to access the local
file and a file system path name to reference the target of the copy. If you
are still getting an error message, post the code you actually used for the
copy. We can only guess at what system the code is on and what values you've
used for the copy command.

--
Virgil
Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dickiedyce | last post by:
Hi there. I've spent the weekend getting ever more frustrated, trying to get an upload file function working on a website. The site is hosted by a company called oneandone. They're using PHP...
2
by: Ron Brennan | last post by:
Good afternoon. The entire task that I'm trying to achieve is to allow a user to browse and upload multiple files simultaneously, hiding the Browse button of <input> tags of type="file" and...
5
by: Ron Brennan | last post by:
Good afternoon. The entire task that I'm trying to achieve is to allow a user to browse and upload multiple files simultaneously, hiding the Browse button of <input> tags of type="file" and...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
2
by: tshad | last post by:
I have a page that I am using for multiple uses that includes reposting of the page as well as going to another page where the "form" tag would be something like: <form id="something"...
5
by: Chris | last post by:
I have a meetings section I'm developing on our intranet. Using PHP/MySQL. Meeting info and Meeting docs reside on 2 related tables in the db. Users may want to upload anywhere from 1 to 10 or...
6
by: ajaykataram | last post by:
Hi all i am getting error in the following code to upload files csv and txt files i have to insert the following values only into database if firstname,lastname and email id is null it should not...
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
0
by: LoriFranklin | last post by:
I'm a bit of a newbie here. I've learned a lot from reading the posts you all have here. I need some help uploading files using an asp form. I am using some code that I found from Jacob at...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.