Hi All,
If I drop a form onto my page that allows file uploads, I know well
enough how to handle the file upload in the server side via PHP.
However, I have a question: when my browser actually *sends* a binary
file (e.g., an image), does it encode it somehow for the upload? Or
does it simply send a raw bytestream?
The reason I am asking is that I am in the process of transferring some
images from one photo gallery to another (in Drupal). Mapping the two
database schemas has proved to be a little tricky, and I am thinking
it would be simpler to use the web interface to re-upload the various
images.
However, rather than do it one at a time, I'd just as soon write a PHP
script that would traverse through the old photo gallery files, and
upload them via HTTP POST (along with other relevant details, such as
descriptive text) and let the web interface make sure that the
database.
I'm comfortable with regular HTTP POST mechanisms, and doing them
programmatically with PHP, but I've never uploaded files that way.
Anything I should know? For example, do they need to be encoded
somehow before upload? Or can I just read in the raw bytestream, and
voila, there we go? 1 2701
On 23 Jan 2006 10:54:31 -0800, jo*******@gmail.com wrote: If I drop a form onto my page that allows file uploads, I know well enough how to handle the file upload in the server side via PHP.
However, I have a question: when my browser actually *sends* a binary file (e.g., an image), does it encode it somehow for the upload? Or does it simply send a raw bytestream?
See: http://www.w3.org/TR/html4/interact/...ml#h-17.13.4.2
Short answer: the file is sent raw (or at least can be, and for images should
be, with an appropriate Content-Transfer-Encoding), but you need some headers
around it.
The reason I am asking is that I am in the process of transferring some images from one photo gallery to another (in Drupal). Mapping the two database schemas has proved to be a little tricky, and I am thinking it would be simpler to use the web interface to re-upload the various images.
However, rather than do it one at a time, I'd just as soon write a PHP script that would traverse through the old photo gallery files, and upload them via HTTP POST (along with other relevant details, such as descriptive text) and let the web interface make sure that the database.
I'm comfortable with regular HTTP POST mechanisms, and doing them programmatically with PHP, but I've never uploaded files that way. Anything I should know? For example, do they need to be encoded somehow before upload? Or can I just read in the raw bytestream, and voila, there we go?
You would probably save yourself some time using cURL if it's available,
rather than writing your own HTTP client code to handle it: http://uk.php.net/curl
HTTP_Request on PEAR also looks like a good bet: http://pear.php.net/manual/en/packag...ile-upload.php
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Anthony Boudouvas |
last post by:
Hi to all,
i try to use Http Post to upload a file at a web server. Web server already
has a page that
it copies the uploaded file in a specifir directory.
The below code returns to me "The...
|
by: John Lee |
last post by:
Hi,
I have a simple web page that allow file to be uploaded, the upload page
looks like the following:
<form method="post" name="upload" enctype="multipart/form-data"...
|
by: Jen |
last post by:
I'm using Microsoft's own VB.NET FTP Example:
http://support.microsoft.com/default.aspx?scid=kb;en-us;832679
I can get the program to create directories, change directories, etc.,
but I can't...
|
by: Mike Kelly |
last post by:
Hi. I've built a page using standard ASP.NET 2.0 features and when I upload a
large file (>20MB) to our intranet server, I get a paltry 100KB/s on our
100Mb/s LAN. Simply copying the file, I get...
|
by: JMB |
last post by:
Hello,
I was wondering if anyone knew of any projects extending the inline upload
progress bar to utilize an inpage image uploader with bar, without having to
refresh or go to a seperate page,...
|
by: Marko Vuksanovic |
last post by:
I used the following code for implementing a file upload progress indicator, using UpdateProgress Panel, though I have a problem that FileUpload.Has File always returns false. Any suggestions what...
|
by: prasenjit2007 |
last post by:
I have a main form for inputing the (to/from/mesg/file) with the following code:-
<html>
<body>
<table>
<tr>
<td>To:</td>
<td><input type="text" name="to" size="50"
...
|
by: Gert Conradie |
last post by:
The following code can uplaod text files. When i upload a binary file
it fail.
I might be:
1) using the wrong Encoding
2) will have to System.Convert.ToBase64String the content of the
binary...
|
by: Vlad |
last post by:
I am having problems using the file.create method within a function
that is called when looping through an array of filepaths.
If I call my function with a hardcoded file path --C:\Temp.txt the...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
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...
| |