Jump to content

Need Help with File Checking


jeff42

Recommended Posts

Hi,

I'm new to php, learning as I go. I'm trying to write a simple file checking function to verify that an uploaded file is a zip file. It works fine for Mac users but not for Windows users. I have no idea why this is happening.

Here's a piece of my code:

if($img_type == "application/zip"){

// COPY FILE TO DIRECTORY
copy($img_data, $path . $new_image_name);

After much frustration, I changed the first line to this:

if("1"){

... and then everything else works as it should. The file gets moved to the right directory, etc.

For some reason it's not recognizing zip files created on Windows machines, at least not with the code I'm using.

Any ideas?

Thanks!
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.