mmarif4u Posted November 7, 2008 Share Posted November 7, 2008 Hi, I have a simple upload script, where i upload some images and flash files with swf extension. But the problem is that swf files are not saving to the target directory, while images can. I am using Linux, the permission are fine on the folder. Saving to database the file name is also fine. Everything is working, except saving to directory. Any ideas about this. Thanks Link to comment https://forums.phpfreaks.com/topic/131740-solved-uploading-flash-files/ Share on other sites More sharing options...
dezkit Posted November 7, 2008 Share Posted November 7, 2008 Are you using php code? Link to comment https://forums.phpfreaks.com/topic/131740-solved-uploading-flash-files/#findComment-684342 Share on other sites More sharing options...
mmarif4u Posted November 7, 2008 Author Share Posted November 7, 2008 Yup, Complete php. Link to comment https://forums.phpfreaks.com/topic/131740-solved-uploading-flash-files/#findComment-684345 Share on other sites More sharing options...
dezkit Posted November 7, 2008 Share Posted November 7, 2008 cen u mebe poast ta coyd? Link to comment https://forums.phpfreaks.com/topic/131740-solved-uploading-flash-files/#findComment-684346 Share on other sites More sharing options...
mmarif4u Posted November 7, 2008 Author Share Posted November 7, 2008 ok. this is the code. $filename = $_FILES['image']['name']; $filesize = $_FILES['image']['size']; $filetype = $_FILES['image']['type']; $file_tmp = $_FILES['image']['tmp_name']; $file_err = $_FILES['image']['error']; $file_ext = strrchr($filename, '.'); $file_ext = strtolower($file_ext); //$strlenmyfile = strlen ($filename); $target = "images/project/"; $target = $target . $myfile . $file_ext ; $ok=1; //This is our size condition (limit 350kb = 350000 bytes and 700kb = 700000 bytes) if ($_FILES['image']['size'] > 700000) { echo "<font color='red'>Error: Your file size is too large.</font><br>"; $ok=0; } if($_FILES['image']['size'] < 1) { echo "<font color='red'>Error: You tried to upload empty file.</font><br>"; $ok=0; } $uploaded_type = $_FILES['image']['type']; echo "<p>"; //echo "<br> file size =". $_FILES['image']['size']; //echo "<br>uploaded_type = $uploaded_type"; echo "</p>"; //This is our limit file type condition if ($uploaded_type =="text/php") { echo "No PHP files<br>"; $ok=0; } elseif ((!($uploaded_type=="image/jpg")) && (!($uploaded_type=="image/jpeg")) && (!($uploaded_type=="image/gif")) && (!($uploaded_type=="application/x-shockwave-flash"))){ echo "You may only upload JPG/GIF/SWF files.<br>You attempted to upload \"$uploaded_type\" type from $myfile<br>"; $ok=0; } //Here we check that $ok was not set to 0 by an error if ($ok==0) { echo "<font color='red'>Error: Sorry your file was not uploaded.</font>"; } //If everything is ok we try to upload it else { list($width, $height) = getimagesize($file_tmp); if($width > 750){ // = imagesx($filename); echo "<center><strong><font class=\"red\">The image width is $width. Please keep it below</font> <font color='blue'>750</font>.</strong></center>"; }else{ if(move_uploaded_file($_FILES['image']['tmp_name'], $target)){ $date=date('Y-m-d H:i:s'); $sql="insert into proj_img(text,file,date)values('$text','$filename','$date')"; $q=mysql_query($sql); echo "<center><strong><font class=\"red\">The file ".basename( $_FILES['uploadedfile']['name']). " has been uploaded</strong></center></font>"; }else{ echo "<font color='red'>Error: Sorry, there was a problem uploading your file.</font>"; } } } Link to comment https://forums.phpfreaks.com/topic/131740-solved-uploading-flash-files/#findComment-684351 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.