Jump to content

POST method upload secure?


Or1g1naL

Recommended Posts

$ext = basename(strtolower($_FILES['ufile']['type'][0]; // "jpg"
if($ext == "x-png" or $ext == "pjpeg" or $ext == "gif"){
  $image_path = $image_directory.$_FILES['ufile']['name'][0];
  copy($_FILES['ufile']['tmp_name'][0], $image1_path);
}

 

Is this a bad idea for public use?

Link to comment
Share on other sites

ym_chaitu - I now understand what you're talking about.  Does this look better?

if($type = "image"){
  $image_path = $image_directory.$_FILES['ufile']['name'][0];
  copy($_FILES['ufile']['tmp_name'][0], $image1_path);
}

 

It would be secure enough right?

Link to comment
Share on other sites

I thought mime_content_type() had been deprecated.

 

I'm just if you think this method of uploading images is secure for public use.

 

You thought? It's good that you read the page, but you should also read the part where it links you to the function(s) that are NOT deprecated.

Link to comment
Share on other sites

You thought? It's good that you read the page, but you should also read the part where it links you to the function(s) that are NOT deprecated.

I already knew it was deprecated.  Everybody knows that.  jeez

 

I'm just asking if uploading an image using a form is secure in your opinion.

I don't want it to upload if it isn't an image file.

Link to comment
Share on other sites

You thought? It's good that you read the page, but you should also read the part where it links you to the function(s) that are NOT deprecated.

I already knew it was deprecated.  Everybody knows that.  jeez

 

I'm just asking if uploading an image using a form is secure in your opinion.

I don't want it to upload if it isn't an image file.

 

Stop asking the same question, You already have multiple valid answers.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.