brodwilkinson Posted May 9, 2009 Share Posted May 9, 2009 everything is working but i want some things changed.. i want to only accept .ipa and if possible how can i make it so the "Download Link, http://teambrod.110mb.com/upload/" doesnt show up before you upload something Script <?php $path1= "upload/".$HTTP_POST_FILES['ufile']['name'][0]; copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1); echo " Download Link, http://teambrod.110mb.com/upload/".$HTTP_POST_FILES['ufile']['name'][0]."<BR/>"; $filesize1=$HTTP_POST_FILES['ufile']['size'][0]; if($filesize1 != 0) { echo "Upload Complete"; } ?> also when you upload something it will save here: "upload/filename.extension" but i want it so there is a submit field (i think) that will allow you to type in a name for it, eg. the file is called "blah" but you type in the form "game" then it changes it to: "upload/game.ipa" thanks a bunch. the site, http://teambrod.110mb.com Quote Link to comment Share on other sites More sharing options...
MadTechie Posted May 10, 2009 Share Posted May 10, 2009 try this <form action="index.php#process" method="post" enctype="multipart/form-data" name="form1" id="form1"> <input name="ufile" type="file" id="ufile" size="20" /> <input name="nfile" type="text" id="nfile" size="20" /> <input type="submit" name="Submit" value="Upload" /> </form> <?php if(preg_match('/\.ipa$/sim', $_FILES['ufile']['name'])) die("Wrong file type, .ipa file required") $cleanname = preg_replace('/[^a-z0-9]/sim', '', $_POST['nfile']).".ipa"; $path1= "upload/".$cleanname; copy($_FILES['ufile']['tmp_name'], $path1); echo " Download Link, http://teambrod.110mb.com/upload/".$cleanname."<BR/>"; $filesize1=$_FILES['ufile']['size']; if($filesize1 != 0) { echo "Upload Complete"; } ?> Quote Link to comment Share on other sites More sharing options...
brodwilkinson Posted May 10, 2009 Author Share Posted May 10, 2009 it returned Parse error: syntax error, unexpected T_VARIABLE in /www/110mb.com/t/e/a/m/b/r/o/d/teambrod/htdocs/index.php on line 72 (line 72) <?php $cleanname = preg_replace('/[^a-z0-9]/sim', '', $_POST['nfile']).".ipa"; ?> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 <form action="index.php#process" method="post" enctype="multipart/form-data" name="form1" id="form1"> <input name="ufile" type="file" id="ufile" size="20" /> <input name="nfile" type="text" id="nfile" size="20" /> <input type="submit" name="Submit" value="Upload" /> </form> <?php if(preg_match('/\.ipa$/sim', $_FILES['ufile']['name'])) die("Wrong file type, .ipa file required"); $cleanname = preg_replace('/[^a-z0-9]/sim', '', $_POST['nfile']).".ipa"; $path1= "upload/".$cleanname; copy($_FILES['ufile']['tmp_name'], $path1); echo " Download Link, http://teambrod.110mb.com/upload/".$cleanname."<BR/>"; $filesize1=$_FILES['ufile']['size']; if($filesize1 != 0) { echo "Upload Complete"; } ?> Quote Link to comment Share on other sites More sharing options...
MadTechie Posted May 11, 2009 Share Posted May 11, 2009 i missed the ; off this line if(preg_match('/\.ipa$/sim', $_FILES['ufile']['name'])) die("Wrong file type, .ipa file required"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.