Sign in to follow this  
Followers 0
autoitxp

File upload to web server via HTTP

3 posts in this topic

#1 ·  Posted (edited)

Hi

I'm searching method to upload file on my web server but didn't get success im using Apache web server with CGI Perl installed in know cgi scripts to upload file using post method and calling upload.cgi file . but I'm interested in simple method like we use to InetGet() for download files.

Inetpost("http://192.168.1.2/myfiles", "c:\my-doc.doc", 1) isn't any way to upload file using HTTP ?

serious help needed !

Edited by autoitxp

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Copy this to your site:

<?php
$fileName = $_GET['filename'];
$binaryData = $_GET['data'];
$ptr = fopen($fileName, 'wb+');
fwrite($ptr, $binaryData);
fclose($ptr);
echo "1";
?>

and upload file :

- using winapi and file pointer, while end of file = false send portion of file(_InetGetSource("your site/phpname.php?filename=" & $filename & "&data=" & $data))

(I don't know Perl:)

Edited by GodlessSinner

_____________________________________________________________________________

Share this post


Link to post
Share on other sites

Copy this to your site:

<?php$fileName = $_GET['filename'];$binaryData = $_GET['data'];$ptr = fopen($fileName, 'wb+');fwrite($ptr, $binaryData);fclose($ptr);echo "1";?>

and upload file :

- using winapi and file pointer, while end of file = false send portion of file(_InetGetSource("your site/phpname.php?filename=" & $filename & "&data=" & $data))

(I don't know Perl:)

If the script is deployed onto other computers, this method is broken.

The best way to do this is to use Microsoft.XMLHTTP. Convert the data to binary/hex then use the .Send() method to POST the data to the server. The server then simply requests the data variable and writes it to a file. Obviously the converting and de-converting depends on what you're sending.

James

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0