ChanHoNam Posted December 15, 2010 Share Posted December 15, 2010 Hi all, i am new here, but i have a working upload php working inside a flash file..... It working perfectly fine with uploading file onto my website. But i would like to add some code in it. Example: if you upload a file through it, i would like it to say " Your file have successfully uploaded" but i want to add the code, if you upload the same image.extension and same size, it would like it to say "Error - File exist!" <?php session_start(); $Directory = "image/"; $DAT = "file/"; $datei=$_GET['datei']; $txt1=$_GET['txt1']; $ok="0"; if ($_SESSION['ko']=="1") { session_unset(); echo "&message=File ".$_SESSION['tempdatei']." u. Information Process!&"; }else{ session_unset(); echo "&message=Server Error or Error File exists!&"; } if ($_FILES['Filedata']) { if (preg_match("/^.*?\.(pdf|wav|mp3|mov|wmv|mpeg|exe|avi|mpg|rar|zip|flv|xls|ppt|doc|mdb|txt|jpg|gif|png|swf|jpeg)$/si",$_FILES['Filedata']['name'])) { if($_FILES['Filedata']['size'] > 0 && $_FILES['Filedata']['size'] < 10485760) { $uploadfile = $Directory.basename($_FILES['Filedata']['name']); if (!file_exists($uploadfile)) { move_uploaded_file($_FILES['Filedata']['tmp_name'], $uploadfile); $_SESSION['ko']=$ok; $_SESSION['tempdatei']=$datei; }else{ echo "&message=check me out!&"; } chmod( $Directory. basename( $_FILES['Filedata']['name']),0644); if (!chmod( $Directory. basename( $_FILES['Filedata']['name']),0644)) { fail("The permissions failed to set to 0644."); } $tx=$DAT.$datei.".txt"; $fp= fopen($tx,'w+'); fwrite($fp,$txt1); fclose($fp); $ok="1"; }}} ?> Link to comment https://forums.phpfreaks.com/topic/221702-need-help-with-upload-php-code/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.