dellvostro Posted October 13, 2008 Share Posted October 13, 2008 We are using tools4php to create our quote forms with captcha. All is working well, however we are not able have eps files attached to quote form, even though when trying to attach a file and submit, it says: Please enter a valid file. jpg gif doc pub and eps Our current code relating to file attachments is as follows: if( $file_Mime_Type != "" AND $file_Mime_Type != "application/msword" AND $file_Mime_Type != "application/postscript" AND $file_Mime_Type != "application/vnd.ms-publisher" AND $file_Mime_Type != "image/gif" AND $file_Mime_Type != "image/pjpeg" AND $file_Mime_Type != "image/jpeg" ) I tried modifying with the following which didnt work: if( $file_Mime_Type != "" AND $file_Mime_Type != "application/msword" AND $file_Mime_Type != "application/postscript" AND $file_Mime_Type != "application/vnd.ms-publisher" AND $file_Mime_Type != "image/gif" AND $file_Mime_Type != "image/pjpeg" AND $file_Mime_Type != "image/jpeg" AND $file_Mime_Type != "image/eps" ) We are also unable to upload pdf files with quote form. I dont see any other file or area to edit that relates to file types that can be uploaded. ??? Any ideas on what may be the problem? Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/128198-tools4php-form-help/ Share on other sites More sharing options...
DarkWater Posted October 13, 2008 Share Posted October 13, 2008 http://filext.com/file-extension/EPS They can have several MIME types, so it'll be hard to add them all in accurately. Also, MIME types from the browser can't be trusted all too much. And btw, that code looks like crap. You should really learn PHP and write up a simple form for yourself. Quote Link to comment https://forums.phpfreaks.com/topic/128198-tools4php-form-help/#findComment-663943 Share on other sites More sharing options...
dellvostro Posted October 13, 2008 Author Share Posted October 13, 2008 DW, thanks for your reply. Unfortunately, I am only filling in and trying to make sense of this coding. We had a programmer create our forms using tools4php software and the owner of the site couldnt help us as to why the eps or pdf files were not able to attach to forms. our old webmaster is no longer available so we are trying to pick up the pieces and try to make the most of it. Quote Link to comment https://forums.phpfreaks.com/topic/128198-tools4php-form-help/#findComment-663996 Share on other sites More sharing options...
DarkWater Posted October 13, 2008 Share Posted October 13, 2008 PHP is surprisingly easy to learn, actually. There are plenty of good starter tutorials on tizag.com and W3Schools. Quote Link to comment https://forums.phpfreaks.com/topic/128198-tools4php-form-help/#findComment-663997 Share on other sites More sharing options...
DarkWater Posted October 13, 2008 Share Posted October 13, 2008 Oh yeah, also, can we see the code AFTER the if statement (the code I want to see should be in { }, so it's probably easy to identify). Please post it in tags though. Quote Link to comment https://forums.phpfreaks.com/topic/128198-tools4php-form-help/#findComment-664000 Share on other sites More sharing options...
dellvostro Posted October 13, 2008 Author Share Posted October 13, 2008 I think this everything your asking for. Thanks for the link. Ill check it out soon as I get a chance. Problem with me learning php is we had severe attacks, header injections about a year ago with an old programmer. Then we hired someone make forms more secure which is what you see here. It seems to work so far, but we cant get eps or pdf files to upload. //delete file unlink($file_Temp); die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Max file size is 500kb. Please enter a valid file.</font></p>"); } if( $file_Mime_Type != "" AND $file_Mime_Type != "application/msword" AND $file_Mime_Type != "application/postscript" AND $file_Mime_Type != "application/vnd.ms-publisher" AND $file_Mime_Type != "image/gif" AND $file_Mime_Type != "image/pjpeg" AND $file_Mime_Type != "image/jpeg" ) { unlink($file_Temp); die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid file. jpg gif doc pub and eps</font></p>"); } //Find the extension to the uploaded file function findexts ($file_Name) { $file_Name = strtolower($file_Name) ; $exts = split("[/\\.]", $file_Name) ; $n = count($exts)-1; $exts = $exts[$n]; return $exts; } //This applies the function to our file $ext = findexts ($_FILES['file']['name']) ; //This line assigns a random number to a variable $ran = rand () ; //This takes the random name $ran2 = $ran."."; Quote Link to comment https://forums.phpfreaks.com/topic/128198-tools4php-form-help/#findComment-664014 Share on other sites More sharing options...
dellvostro Posted October 22, 2008 Author Share Posted October 22, 2008 can anyone help on this? we need to be able to receive pdf and eps files. thank you. Quote Link to comment https://forums.phpfreaks.com/topic/128198-tools4php-form-help/#findComment-671724 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.