HaLo2FrEeEk Posted April 6, 2007 Share Posted April 6, 2007 Hey, I'm making an upload form for people to upload files in ppf and sppf format, the mime type of which is "application/octet-stream", the files are obviously non standard. I need to be able to check that the file being uploaded is of the type sppf or ppf, only, nothing else, I am uploading using a POST form. I know that I would use javascript and php to get all the characters after the last . (dot) and check that they are equal to either sppf or ppf, but also, I know that someone could create form on a remote server and use my upload url as the action of the form, effectively bypassing any blocks of upload type. I also know that I could use php after the file is uploaded to discard it if it is not either a sppf or ppf file. What I need to know is this, is there a way to do this before the file is uploaded, without javascript, could I have a middle step? Right now I go directly from the form to upload (in a switch statement, I have default and upload) could I add validate to that switch statement? I don't think that would work, becuase someone could still do it remotely. Maybe I could, in the upload case of the switch statement, check that the userfile variable (being passed via POST method fromt he form) has the extension sppf or ppf, if it does, it uploads it, if not, it cancels. Would this work, and if not, could someone please give me an alternative to avoid checking after the file is uploaded. Thank you. Link to comment https://forums.phpfreaks.com/topic/45845-validating-uploads-before-uploading-a-non-standard-file-type/ Share on other sites More sharing options...
HaLo2FrEeEk Posted April 6, 2007 Author Share Posted April 6, 2007 Bump. Link to comment https://forums.phpfreaks.com/topic/45845-validating-uploads-before-uploading-a-non-standard-file-type/#findComment-222769 Share on other sites More sharing options...
HaLo2FrEeEk Posted April 6, 2007 Author Share Posted April 6, 2007 b u m p jesus. Link to comment https://forums.phpfreaks.com/topic/45845-validating-uploads-before-uploading-a-non-standard-file-type/#findComment-222787 Share on other sites More sharing options...
trq Posted April 6, 2007 Share Posted April 6, 2007 There is no way of verifying a files type until it has been uploaded. Link to comment https://forums.phpfreaks.com/topic/45845-validating-uploads-before-uploading-a-non-standard-file-type/#findComment-222802 Share on other sites More sharing options...
HaLo2FrEeEk Posted April 7, 2007 Author Share Posted April 7, 2007 Since I am sending the file through POST, could I do a check in the upload part of my switch statement that gets the extension, (which is all I need to check, not the mime type, since it is non standard,) and checks if it is either sppf or ppf? Could I do this, that way, if it is not sppf or ppf, I could cancel the script. Link to comment https://forums.phpfreaks.com/topic/45845-validating-uploads-before-uploading-a-non-standard-file-type/#findComment-223458 Share on other sites More sharing options...
HaLo2FrEeEk Posted April 8, 2007 Author Share Posted April 8, 2007 Uhm, can someone PLEASE help me, why do my posts always get ignored? Link to comment https://forums.phpfreaks.com/topic/45845-validating-uploads-before-uploading-a-non-standard-file-type/#findComment-224006 Share on other sites More sharing options...
HaLo2FrEeEk Posted April 8, 2007 Author Share Posted April 8, 2007 beep...I mean, bump...lol I still need some help, is what I suggested possible? Link to comment https://forums.phpfreaks.com/topic/45845-validating-uploads-before-uploading-a-non-standard-file-type/#findComment-224031 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.