Sending a file to HTTP server via a multi-part flat form
| starter08 (5) | |||
| Hi, I need to send a flat file to http server. The file that needs to be sent is an xml file which is created by another routine. FTP is not an option, I have to send it to an http server via a multi-part form. Appreciate any help in this regards. So far I have this code, but getting this error in apache2 logs "[error] [client 192.168.2.20] Attempt to serve directory: /usr/local/sam/web/" code snippet for sending the file
Really appreciate any help Thanks | |||
| guestgulkan (405) | |||
| Having a scoot around with google, this appears to be a server configuration error - but beyond that I can't really say. I see lots of hits about missing default page(s) like missing default.html or index.html, etc.. There seem to be a few reasons why this error can be logged - which may be nothing to do with your code. | |||
| Zaita (1450) | |||
| Is SCP an option? Because you are looking at a whole raft of security related issues by doing this via an HTTP request through to a server-side object. | |||
| starter08 (5) | |||
| Hi, This is a part of a secure proprietary kernel so I am not worried about the security issues as those will already be taken care of. I realized that there was no index file in the document root servred by apache so the earlier apache error, that is fixed. However not I get the following response from the server
I am not sure why segmentation fault is occuring, though the http response is ok however the file is not uploaded to the webserver. Also I am not sure about the Content-Length given in the response from the server, is that the length of data server sent ? could segementation fault be because of this? Appreciate any help. | |||
| Zaita (1450) | |||
| Segmentation Fault indicates that apache has suffered a buffer-overflow. Content Length should be the number of bytes you are sending within the POST request. Not including the header. | |||
| starter08 (5) | |||
| Hi, Ok I resolved the segmentation fault error, however still the file is not uploaded to the server. Do I also need some script on the server side to receive the file and write it to a directory or the file should be uploaded to the default web directory ? Appreciate any help. Thanks | |||
| Zaita (1450) | |||
| You need a server-side script. Again, I don't know why you just don't use SCP | |||
| starter08 (5) | |||
| Hi, Thanks for the reply. I cannot use scp because the server where we need to send the file will only accept http requests nothing else. Thanks for the reply again. | |||
| Zaita (1450) | |||
| If this is a web-hosting account your trying to upload the file to. I'd check to see if the server can handle what your trying to do. Alot of places have their configurations for PHP/.NET set so you can't upload a file. Edit: How are you going to upload your server-side code when you can't FTP or SCP? | |||
| starter08 (5) | |||
| Hi, We have full control over the server and can put the server-side code on the server, however nothing is accessible to anybody except http requests over the net. I tried writing server side code however we cannot bind port 80 as it is a well known port. The php config allows uploading of files and the size of the file is also set so that the file I am trying to upload will not have any problems regarding the size. For sending the file I open it in binary mode for reading and then send the content of the files to the server, is that the right way to send the file.
in the code above Traveller_output_buffer, has the contents of the file. Appreciate your help. Thanks, | |||
| Zaita (1450) | |||
| So you want other people to be able to upload files? Why not just have them do it through a web-form? | |||
This topic is archived - New replies not allowed.
