cagintranet
Jun 19th 2005, 10:51 am
Hello All,
I am trying to create a page where my clients can upload files to me so that i can view them (sometimes email blocks/filters attachments, and plus this is much easier if i can get it working)
the page is here: http://www.cagintranet.com/ftp/indexnew.php
what i am trying to do is make sure someone has the validation code that i provide them before they are allowed to upload a file.
this is what i have so far:
<?php
echo "<br><FONT SIZE=2 face=arial COLOR=#000000><b>Upload all files here. Please be patient.</b> <br>You will receive an email from Cagintranet after we have confimed we received all your files.<br><br></font>";
$max="99999999"; //Maximum filesize in bytes
$validate="tempvalidationcode"; //validation code
if($action=="doupload") {
$picture = "fileupload"."_name";
$file1 = $$picture;
$file2 = "fileupload";
$file3 = $$file2;
if($file3 != "none"){
$filesizebtyes = filesize($file3);
if($validate = "validatebox") {
if(file_exists("$file3")&& $filesizebtyes <= "$max") {
copy ($file3, "$file1");
echo "<FONT SIZE=2 face=arial COLOR=#3366ff>File $file1 has been uploaded</font>";
} elseif($filesizebtyes <= "$max") {
copy ($file3, "$file1");
echo "<FONT SIZE=2 face=arial COLOR=#3366ff>File $file1 has been uploaded</font>";
}else{
echo "<FONT SIZE=2 face=arial COLOR=#990000>Filesize is greater than $max bytes</font>";
}
} else {
echo "<FONT SIZE=2 face=arial COLOR=#990000>Validation code entered is incorrect</font>";
}
}
}
echo"<br><br><FONT face=arial SIZE=2 COLOR=#000000>Validation Code: </font><input type=text name=validatebox size=8 class=formclass onfocus=this.style.backgroundColor='#FFFFCC' onblur=this.style.backgroundColor='#ffffff'><br><form ENCTYPE=multipart/form-data method=post action=?action=doupload> <input type=file name=fileupload class=formclass onfocus=this.style.backgroundColor='#FFFFCC' onblur=this.style.backgroundColor='#ffffff'> <input type=submit value=Upload class=formclass ></form><FONT face=arial SIZE=1 COLOR=#000000>Powered by <A HREF='http://www.cgixp.tk' target='_blank'>Smart PHP Uploader</A></FONT>";
?>
Right now as that code stands, people can submit anyhting whether they type in the validation code correctly or not. (also on a side note, is there any way to make sure they are entering in a valid file name in the browse box? The code allows you to type in c:\sdafasdfasdf and it would upload that file whether or not it exists on the local computer or not)
Any help would be greatly appricated!!
Chris
I am trying to create a page where my clients can upload files to me so that i can view them (sometimes email blocks/filters attachments, and plus this is much easier if i can get it working)
the page is here: http://www.cagintranet.com/ftp/indexnew.php
what i am trying to do is make sure someone has the validation code that i provide them before they are allowed to upload a file.
this is what i have so far:
<?php
echo "<br><FONT SIZE=2 face=arial COLOR=#000000><b>Upload all files here. Please be patient.</b> <br>You will receive an email from Cagintranet after we have confimed we received all your files.<br><br></font>";
$max="99999999"; //Maximum filesize in bytes
$validate="tempvalidationcode"; //validation code
if($action=="doupload") {
$picture = "fileupload"."_name";
$file1 = $$picture;
$file2 = "fileupload";
$file3 = $$file2;
if($file3 != "none"){
$filesizebtyes = filesize($file3);
if($validate = "validatebox") {
if(file_exists("$file3")&& $filesizebtyes <= "$max") {
copy ($file3, "$file1");
echo "<FONT SIZE=2 face=arial COLOR=#3366ff>File $file1 has been uploaded</font>";
} elseif($filesizebtyes <= "$max") {
copy ($file3, "$file1");
echo "<FONT SIZE=2 face=arial COLOR=#3366ff>File $file1 has been uploaded</font>";
}else{
echo "<FONT SIZE=2 face=arial COLOR=#990000>Filesize is greater than $max bytes</font>";
}
} else {
echo "<FONT SIZE=2 face=arial COLOR=#990000>Validation code entered is incorrect</font>";
}
}
}
echo"<br><br><FONT face=arial SIZE=2 COLOR=#000000>Validation Code: </font><input type=text name=validatebox size=8 class=formclass onfocus=this.style.backgroundColor='#FFFFCC' onblur=this.style.backgroundColor='#ffffff'><br><form ENCTYPE=multipart/form-data method=post action=?action=doupload> <input type=file name=fileupload class=formclass onfocus=this.style.backgroundColor='#FFFFCC' onblur=this.style.backgroundColor='#ffffff'> <input type=submit value=Upload class=formclass ></form><FONT face=arial SIZE=1 COLOR=#000000>Powered by <A HREF='http://www.cgixp.tk' target='_blank'>Smart PHP Uploader</A></FONT>";
?>
Right now as that code stands, people can submit anyhting whether they type in the validation code correctly or not. (also on a side note, is there any way to make sure they are entering in a valid file name in the browse box? The code allows you to type in c:\sdafasdfasdf and it would upload that file whether or not it exists on the local computer or not)
Any help would be greatly appricated!!
Chris