Hello.
I was wondering, could someone make a script that would upload multiple files to a directory?
For example i write /upload file1.jpg file2.exe file3.txt file4.txt file5.jpg , and it uploads all of them to a directory on a webserver, and then echo'es in mirc - Done uploading files!
All of the upload scripts I have seen can upload only one file. could someone help me out?
/*
How the script is currently configured it works like this (EXAMPLE):
-The user types '/upload test.exe' (test.exe is in the mirc dir)
-The script will submit the file to
www.google.com/upload.php-The php file will move the file 'test.exe' to the dir 'upload/'
-The file can be found at 'www.google.com/upload/test.exe'
-This is an example
-- CONTENT OF THE PHP FILE NAMED 'upload.php' (remember the mirc script must point to this file --
<?php
//Set uploaddir, remember that for that folder you must set read+write permission,
//look for the command CHMOD and set the permissions in the folder to '777'
$uploaddir = "upload/";
$file = $uploaddir . $_FILES['uploadfile']['name'];
move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)
?>
--------------------------------------------------------------------------------------------------
*/
alias upload {
;-- Set these variables --
%hostofphpfile =
www.google.com %locationofphpfile = /upload.php
;-------------------------
%dest = $$1-
if ((!$file(%dest)) || ($isdir(%dest))) return
.remove upload.tmp
echo -a Uploading file %dest $+ ....
sockopen upload %hostofphpfile 80
}
On *:sockopen:upload:{
var %b = $md5() | write -c upload.tmp $+(--,%b,$lf,$&
Content-Disposition: form-data; name="uploadfile";,$&
filename=",$nopath(%dest),",$lf,$lf)
.copy -a " $+ %dest $+ " upload.tmp
write upload.tmp -- $+ %b
var %write = sockwrite -tn upload
%write POST %locationofphpfile HTTP/1.1
%write Host: %hostofphpfile
%write Connection: close
%write Content-Type: multipart/form-data; boundary= $+ %b
%write Content-Length: $file(upload.tmp)
%write
.fopen upload upload.tmp
}
On *:sockwrite:upload:{
if $sock(upload).sq > 8192 || !$fopen(upload) { return }
if $fread(upload,8192,&a) {
sockwrite upload &a
}
else .fclose upload
}
On *:sockread:upload:{
var %temp
sockread %temp
if & 2* iswm %temp {
echo 3 -a SUCCESS!
}
elseif & 4* iswm & temp {
echo 4 -a FAILED!
}
}
On *:sockclose:upload:cleanupload
alias cleanupload {
.sockclose upload
if $fopen(upload) { .fclose upload }
unset %dest
.remove upload.tmp
}