timgolding
08-03-2007, 01:15 PM
I dint know where to post this but here is a really cool thing i just made. Let me start by telling you what it does and why it does it.
I am always having to share files with people especially players from my hl2dm gaming clan. Most of whom are on MSN. If they are on MSN its very cool because I can literally drag a file into the message box and it automatically offers a d/l link for the recipient to D/l. Which is cool
However if a user hasn't got any MSN installed i have to find a different way to upload files to them. This is how i would of done this (using WAMP).
1. find file.
2. Copy file.
3. goto c:\WAMP\WWW\send
4. paste file into send
5. goto CMD
6. do IPCONFIG
7. Copy the IP address
8. Paste somewhere
9. pretend to rename file so i can copy file name.
10. Paste that after IP part.
11. Copy whole thing and give to user.
Thats 11 steps to bordem.
So being the brainiac i am i decide to develop a drag and drop program. Its a simple BAT file that sits on my desktop and i can drag a file on to it. The batch then does the following
1. Start WAMP
2. Start services
3. Copy dragged file to c:\wamp\www\send
4. Output the download URL
This way all i have to do is drag my file onto the BAT program and it automatically starts wamp and creates a download link to that file. Pretty cool hey?
So heres the codes and instructions for installation
1. create a BAT file on your desktop i named mine "auto_up_tool.bat"
2. right click and edit
3. Insert the codes below and save
cd c:\wamp
START wampserver.exe
NET START wampapache
NET START wampmysqld
START firefox localhost/send?file=%1
exit
4. If you haven't already got it Download http://www.wampserver.com/en/ and install it.
5. Now we have to make a PHP script to handle the request sent by the BAT file.
6. goto c:\WAMP\WWW and create a folder called send make sure this has full read permissions and that system has write permissions.
7. Go into your new send folder and create a file called index.php
8 right click index.php and edit.
9 Insert these codes
<?PHP
$the_file=NULL;
$file=$_GET['file'];
$file=str_replace(chr(92).chr(92), chr(92), $file);
echo $file.' <br /> Was the file to be sent<br />copying file';
$RL_array=explode(chr(92), $file);
$the_file=$RL_array[sizeof($RL_array)-1];
$URL='copy "'.$file.'" "C:'.chr(92).'wamp'.chr(92).'www'.chr(92).'send'.chr(92).$the_file.'"';
$moved=shell_exec($URL);
$server_ip=shell_exec('ipconfig.exe | find "IP Address" | find /v " 0.0.0.0"');
preg_match( '/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/', $server_ip , $ip );
echo '<br />
Here is the download link
<br /> <a href="http://'.$ip[0].'/send/'.$the_file.'" >http://'.$ip[0].'/send/'.$the_file.'</a>';
?>
Now go back to desktop and test it. drag a file on to the BAT file and watch it. HF :D
I am always having to share files with people especially players from my hl2dm gaming clan. Most of whom are on MSN. If they are on MSN its very cool because I can literally drag a file into the message box and it automatically offers a d/l link for the recipient to D/l. Which is cool
However if a user hasn't got any MSN installed i have to find a different way to upload files to them. This is how i would of done this (using WAMP).
1. find file.
2. Copy file.
3. goto c:\WAMP\WWW\send
4. paste file into send
5. goto CMD
6. do IPCONFIG
7. Copy the IP address
8. Paste somewhere
9. pretend to rename file so i can copy file name.
10. Paste that after IP part.
11. Copy whole thing and give to user.
Thats 11 steps to bordem.
So being the brainiac i am i decide to develop a drag and drop program. Its a simple BAT file that sits on my desktop and i can drag a file on to it. The batch then does the following
1. Start WAMP
2. Start services
3. Copy dragged file to c:\wamp\www\send
4. Output the download URL
This way all i have to do is drag my file onto the BAT program and it automatically starts wamp and creates a download link to that file. Pretty cool hey?
So heres the codes and instructions for installation
1. create a BAT file on your desktop i named mine "auto_up_tool.bat"
2. right click and edit
3. Insert the codes below and save
cd c:\wamp
START wampserver.exe
NET START wampapache
NET START wampmysqld
START firefox localhost/send?file=%1
exit
4. If you haven't already got it Download http://www.wampserver.com/en/ and install it.
5. Now we have to make a PHP script to handle the request sent by the BAT file.
6. goto c:\WAMP\WWW and create a folder called send make sure this has full read permissions and that system has write permissions.
7. Go into your new send folder and create a file called index.php
8 right click index.php and edit.
9 Insert these codes
<?PHP
$the_file=NULL;
$file=$_GET['file'];
$file=str_replace(chr(92).chr(92), chr(92), $file);
echo $file.' <br /> Was the file to be sent<br />copying file';
$RL_array=explode(chr(92), $file);
$the_file=$RL_array[sizeof($RL_array)-1];
$URL='copy "'.$file.'" "C:'.chr(92).'wamp'.chr(92).'www'.chr(92).'send'.chr(92).$the_file.'"';
$moved=shell_exec($URL);
$server_ip=shell_exec('ipconfig.exe | find "IP Address" | find /v " 0.0.0.0"');
preg_match( '/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/', $server_ip , $ip );
echo '<br />
Here is the download link
<br /> <a href="http://'.$ip[0].'/send/'.$the_file.'" >http://'.$ip[0].'/send/'.$the_file.'</a>';
?>
Now go back to desktop and test it. drag a file on to the BAT file and watch it. HF :D