Hi folks...
I have a problem uploading a file to a web server.
I created an html page with a multipart/form-data form and used
cgi.parse_multipart function to obtain form data (and obviuosly
uploaded file).
I noticed that if I upload an excutable file, I obtain a file where
0x0a 0x0a, are converted in 0x0a and 0x2e.
Obviously this file is corrupted.
When I save the file, I use 'wb' flags to create a binary file...
Analyzing the file before cgi.parse_multipart, it's possible to
verify that it's correct but when this function tries to extract its
value, 0x0a 0x0a are converted in 0x0a and 02e.
Any suggestion?
Thanks a lot... 2 2258
Michele Belloli <mk*******@libero.it> wrote: I have a problem uploading a file to a web server.
I created an html page with a multipart/form-data form and used cgi.parse_multipart function to obtain form data (and obviuosly uploaded file). I noticed that if I upload an excutable file, I obtain a file where 0x0a 0x0a, are converted in 0x0a and 0x2e. Obviously this file is corrupted.
Are you sure? We had something similar reported just a few weeks ago where
the bug turned out to be in the program displaying the hex results; the
binary file was just fine.
I have used cgi.py to handle large file uploads literally tens of thousands
of times, and never had one go bad.
Analyzing the file before cgi.parse_multipart, it's possible to verify that it's correct but when this function tries to extract its value, 0x0a 0x0a are converted in 0x0a and 02e.
How are you determining this? That is, how are you accessing the final
data?
What operating system and what web server?
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
On Wed, 01 Oct 2003 20:23:56 -0700, Tim Roberts <ti**@probo.com>
wrote: Michele Belloli <mk*******@libero.it> wrote: I have a problem uploading a file to a web server.
I created an html page with a multipart/form-data form and used cgi.parse_multipart function to obtain form data (and obviuosly uploaded file). I noticed that if I upload an excutable file, I obtain a file where 0x0a 0x0a, are converted in 0x0a and 0x2e. Obviously this file is corrupted. Are you sure? We had something similar reported just a few weeks ago where the bug turned out to be in the program displaying the hex results; the binary file was just fine
I have used cgi.py to handle large file uploads literally tens of thousands of times, and never had one go bad.
I read cgi.py, in particular 'parse_multipart'; and I repeated each
command in a python shell.
It works fine.
I use the same version (2.2.3) in Python shell and web server but I
obtain two different behaviuors. Analyzing the file before cgi.parse_multipart, it's possible to verify that it's correct but when this function tries to extract its value, 0x0a 0x0a are converted in 0x0a and 02e.
How are you determining this? That is, how are you accessing the final data?
I noticed a bug displaying the hex results using 'print' statement
too, so I created a binary file (using 'wb' flags) and write down
results. Then, I read it using an hex-editor.
Reading file, I tought 'write' method could modify result like 'print'
statement do.
So I used a simple conditional statement.
if result =='\x2e':
file.write(.....)
Both test in cgi.parse_mulitpart shows the problem.
What operating system and what web server?
W2K and python web server using SimpleHTTPServer classes
Thanks This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Stub |
last post by:
Docs says that "The compiler does not use an explicit constructor to
implement an implied conversion of types. It's purpose is reserved
explicitly for construction."
I put up code of three cases...
|
by: Michael Lehn |
last post by:
Hi,
I have a question regarding the conversion of objects. When is the
conversion done by the constructor and when by the operator. My feeling
tells me that the constructor is preferred. But...
|
by: TTroy |
last post by:
Hello, I'm relatively new to C and have gone through more than 4 books
on it. None mentioned anything about integral promotion, arithmetic
conversion, value preserving and unsigned preserving. ...
|
by: Bjørn Augestad |
last post by:
Below is a program which converts a double to an integer in two
different ways, giving me two different values for the int. The basic
expression is 1.0 / (1.0 * 365.0) which should be 365, but one...
|
by: Steve Gough |
last post by:
Could anyone please help me to understand what is happening here? The
commented line produces an error, which is what I expected given that
there is no conversion defined from type double to type...
|
by: Alex Sedow |
last post by:
Why explicit conversion from SomeType* to IntPtr is not ambiguous (according
to standart)?
Example:
// System.IntPtr
class IntPtr
{
public static explicit System.IntPtr (int);
public...
|
by: Steve Richter |
last post by:
here is a warning I am getting in a C++ .NET compile:
c:\SrNet\jury\JuryTest.cpp(55) : warning C4927: illegal conversion;
more than one user-defined conversion has been implicitly applied
while...
|
by: Richard G. Riley |
last post by:
Would it be wrong to use "implicit casting" instead of the standards
"implicit conversion" when talking about implicit conversions between
certain data types. The standard mentions "explicit...
|
by: Lou Evart |
last post by:
DOCUMENT CONVERSION SERVICES
Softline International (SII) operates one of the industry's largest
document and data conversion service bureaus. In the past year, SII
converted over a million...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
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,...
|
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...
| |