Jump to content

submit file help


luke_barnes

Recommended Posts

this is my code for a submit form.

all i want to do id create a script that allows users to upload files but only in zip or rar files.

 

 

<?php

 

// properties of the uploaded file

$name = $_FILES["myfile"]["name"];

$type = $_FILES["myfile"]["type"];

$size = $_FILES["myfile"]["size"];

$temp = $_FILES["myfile"]["tmp_name"];

$error = $_FILES["myfile"]["error"];

 

if($error > 0)

 

die("Error uploading file! Code $error.");

else

{

 

if ($type!="application/zip" && $type!="application/rar") //conditions for the file

{

die("Format not allowed or file size too big!");

}

else

{

move_uploaded_file($temp,"uploaded/".$name);

echo "Upload complete!";

}

 

}

 

 

 

?>

 

the problems im having is that this code lets nothing through and if i change != to == then it just lets everything through. i cant win at the moment. any idea?

Link to comment
https://forums.phpfreaks.com/topic/156579-submit-file-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.