[Solved]

Started by talross, October 19, 2014, 12:49:43 AM

Previous topic - Next topic

talross

SMF: 2.0.9
PHP version: 5.3.28
MySQL version: 5.5.37-35.0

I found another way to make it all work and come together. Thanks for the help, though. :)

Sir Osis of Liver

See if any of this helps with your uploader script -



$target = "uploads/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$uploaded_name = basename( $_FILES['uploaded']['name']) ;
$uploaded_type = $_FILES['uploaded']['type'];
$uploaded_size = $_FILES['uploaded']['size'];
$songtitle = $_POST['songtitle'];

$ok=1;

if ($uploaded_name == "")
{
echo 'Please select a file to upload.';
$ok=0;
$duh=1;
}

else

if (($uploaded_type != "image/x-png")
&& ($uploaded_type != "image/png")
&& ($uploaded_type != "image/gif")
&& ($uploaded_type != "image/bmp")
&& ($uploaded_type != "image/jpeg")
&& ($uploaded_type != "image/pjpeg")
&& ($uploaded_type != "audio/mpeg")
&& ($uploaded_type != "audio/x-mpeg")
&& ($uploaded_type != "audio/mp3")
&& ($uploaded_type != "audio/x-mp3")
&& ($uploaded_type != "audio/mpeg3")
&& ($uploaded_type != "audio/x-mpeg3")
&& ($uploaded_type != "audio/mpg")
&& ($uploaded_type != "audio/x-mpg")
&& ($uploaded_type != "audio/x-mpegaudio")
&& ($uploaded_type != "audio/x-amzaudio")
&& ($uploaded_type != "video/x-ms-wmv")
&& ($uploaded_type != "video/avi"))

{
echo "File type &nbsp<b><font face='arial'>" . $uploaded_type . "</font></b>&nbsp is not allowed." . "<br><br>";
$ok=0;
}



There are several png and jpg mime types.  The last line will echo the type being refused.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

talross

I added:
if (($uploaded_type != "image/x-png")
&& ($uploaded_type != "image/png")
&& ($uploaded_type != "image/gif")
&& ($uploaded_type != "image/bmp")
&& ($uploaded_type != "image/jpeg")
&& ($uploaded_type != "image/pjpeg")
/*&& ($uploaded_type != "audio/mpeg")
&& ($uploaded_type != "audio/x-mpeg")
&& ($uploaded_type != "audio/mp3")
&& ($uploaded_type != "audio/x-mp3")
&& ($uploaded_type != "audio/mpeg3")
&& ($uploaded_type != "audio/x-mpeg3")
&& ($uploaded_type != "audio/mpg")
&& ($uploaded_type != "audio/x-mpg")
&& ($uploaded_type != "audio/x-mpegaudio")
&& ($uploaded_type != "audio/x-amzaudio")
&& ($uploaded_type != "video/x-ms-wmv")
&& ($uploaded_type != "video/avi")*/)

{
echo "File type &nbsp<b><font face='arial'>" . $uploaded_type . "</font></b>&nbsp is not allowed." . "<br><br>";
$ok=0;
}


In place of:
if (!($uploadFile_type == "image/png")) {
    echo "Sorry, only PNG files are allowed.";
    $uploadOk = 0;
}


And got the error:
"File type    is not allowed.

Sorry, your file was not uploaded."

I tried uploading a .png and .jpg image.

Sir Osis of Liver

Is it echoing a file type?  Did you define $uploaded_type at top of script?



$uploaded_type = $_FILES['uploaded']['type'];



Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

talross

Derp. Yeah. Got that part in and the "File type    is not allowed" went away.

Still got the "Sorry, your file was not uploaded" though, with no other error saying why. Gonna play with it some more and see if I can't straighten it out.

Bigguy

This thread would have been a lot better if the title had been left intact and the solution to whatever the problem was remained. As it stands right now this thread is not very useful.

talross

The solution was a completely different workaround, and I don't necessarily trust the way I bootlegged it enough to leave up for someone else to stumble into.

Bigguy


Advertisement: