473,395 Members | 1,931 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.

PHP and File uploads

HC
One of the websites I work with has a form to fill in which includes an
input to allow me to upload a file. I'm trying to write a PHP script to
automate the process, but I can't figure out how to make PHP upload the
file. I've been playing about with curl, but haven't had any luck.

The issue is that the data I want to upload isn't actually in a file;
it's sitting in a variable in a PHP script, and all the examples I've
found seem to assume an existing file, which for various reasons I want
to avoid.

If anyone could point me in the right direction, I would really
appreciate it!

HC
May 5 '06 #1
6 1102
HC
HC wrote:
One of the websites I work with has a form to fill in which includes an
input to allow me to upload a file.


I should have mentioned, this is done over SSL.

Thanks,
HC
May 5 '06 #2
Is it that you have the data in a variable and you want to create a
file on your server and insert the data present in the variable into
the file? if so, then fopen(), fwrite() are the functions you should be
looking at.

Look in the manual for detailed information.

Hope this helps.

Thanks and God Bless!!

Ehsan
http://ehsan.bdwebwork.com

May 5 '06 #3
HC wrote:
One of the websites I work with has a form to fill in which includes an
input to allow me to upload a file. I'm trying to write a PHP script to
automate the process, but I can't figure out how to make PHP upload the
file. I've been playing about with curl, but haven't had any luck.

The issue is that the data I want to upload isn't actually in a file;
it's sitting in a variable in a PHP script, and all the examples I've
found seem to assume an existing file, which for various reasons I want
to avoid.

If anyone could point me in the right direction, I would really
appreciate it!

HC


HC,

I'm not clear what you mean wit "input to allow me to upload a file".

Are you saying you have a field where you place a filename and the file gets
upload? Or is this a textarea you need to paste the contents of the file for
uploading?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 5 '06 #4
HC
Jerry Stuckle wrote:
I'm not clear what you mean wit "input to allow me to upload a file".


Basically, the form has <input type='file'>. The script I'm trying to
write should send data to that for processing.

Ehsan, I do know how to use fopen() and fwrite(), but ideally, I don't
want to have to write the data to a file.

Thanks for both of your replies :)

HC
May 5 '06 #5
HC wrote:
Jerry Stuckle wrote:
I'm not clear what you mean wit "input to allow me to upload a file".

Basically, the form has <input type='file'>. The script I'm trying to
write should send data to that for processing.

Ehsan, I do know how to use fopen() and fwrite(), but ideally, I don't
want to have to write the data to a file.

Thanks for both of your replies :)

HC


Well, you can plug a default filename in there. But you can't actually retrieve
the file from the client computer with PHP. You need the user to fill in the
field and submit the form.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 5 '06 #6
Jerry Stuckle wrote:
HC wrote:
Jerry Stuckle wrote:
I'm not clear what you mean wit "input to allow me to upload a file".


Basically, the form has <input type='file'>. The script I'm trying to
write should send data to that for processing.

Ehsan, I do know how to use fopen() and fwrite(), but ideally, I don't
want to have to write the data to a file.

Thanks for both of your replies :)

HC

Well, you can plug a default filename in there. But you can't actually
retrieve the file from the client computer with PHP. You need the user
to fill in the field and submit the form.


Actually, I'm wrong. You can't plug a default filename in. I was thinking of
and text input field.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 5 '06 #7

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

Similar topics

3
by: kafooey | last post by:
Hi all, I've been digging around on the newsgroups and the web for a possible answer for this problem, but have so far come up with nothing so thought I would ask here... I have the following...
1
by: Doug Helm | last post by:
I should have been more clear in my subject line. I was also the poster in the "File Uploads" topic. I'm not having any luck getting file uploads to work (multi-part HTML form) on a Windows...
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...
5
by: Kikoz | last post by:
Hi all. I assume that if the user uploads a file from aspx page IIS will put all future requests to the same page from other users in a line and all of them will be waiting until this upload...
4
by: yehaimanish | last post by:
I am developing the project management system. Each Project: 1. Title, description ... , stored in mysql database 2. Upto ten files (initial description), (name in db, file in file system) 3....
4
by: mcrose | last post by:
I've written theh standard applicaiton for our client to allow indexed (customer name, subject etc) file uploads via secure http using the <input type='file'http element. This works great, and has...
3
by: markus.rietzler | last post by:
i want to do (multiple) file upload(s) and display a progress bar. with firefox and safari it is no problem at all. only IE makes some problems. my script is based on ajax-uploader, which can be...
6
by: Emmanuel Petit | last post by:
First of all I am rather new into PHP. I use php 5 and I am putting together a web site for a local association I belong too. Most of the site is okay, except for this problem : I need to be...
6
by: Milan Krejci | last post by:
while(list($key,$value) = each($_FILES)) { if(!empty($value)){ $filename = $value; $add = "upimg/$filename"; echo $_FILES; $error=copy($_FILES, $add); if (!$error)...
10
by: =?ISO-8859-1?B?UOlw6g==?= | last post by:
Hello. Im new to php and i had experience in ASP. IM trying to get a pdf file from a remote folder and what happens is that opens a new page. Here is the code: <a...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.