Hello everyone, i am new here so if this is posted in the wrong spot I do apologize.
Anyways, I made a website for some friends of mine for their Gym. I made it so that they can upload the new workout of the day on their website with PHP/MySQL. The whole site works fine for the most part, however, when the user uploads the new workout from his Iphone, it will allow him to add the new workout, but it will not add the image that he selects to upload Instead it just gives you generic small red 'X' instead of the image. The image upload works fine from any computer and so far it works fine on any browser I have tested it on. Is there something special I would need to do to make the image upload from an Iphone?
Here is my code for the portion: Also, I know that there is no security for the upload or any decent re sizing , but I have followed several image re size and security tutorials and am unable to understand them.
Any help help would be greatly appreciated. I thank you all for your time.
PHP Code:
<?php
include 'core/init.php';
protect_page();
header("Location: wod_admin.php");
function GetFileName($f)
{
/*
* this function will get the name of a file
* for Instance if the file is image14.jpg
* only image14 will be returned.
BY wilson382
*/
$h=substr($f,strrpos($f,"/"),strrpos($f,"."));
$FileName= substr($h,1,strrpos($h,".")-1);
// select all rows that are not the top 4
$sql = mysql_query("SELECT * FROM `wod` WHERE `id` NOT IN (SELECT * FROM (SELECT `id` FROM `wod` ORDER BY `id` DESC LIMIT 4) AS `ids_to_keep`)");
while($row = mysql_fetch_assoc($sql)) {
$del = mysql_query(sprintf("DELETE FROM `wod` WHERE `id` = %d", (int) $row['id'])); // delete current row
unlink($row['imagelocation']); // remove image from current row
}
$sql="INSERT INTO `wod` SET `month`='$_month',
`day`='$_day',
`year`='$_year',
`name`='$_name',
`w1`='$_w1',
`w2`='$_w2',
`w3`='$_w3',
`w4`='$_w4',
`w5`='$_w5',
`w6`='$_w6',
`comment`='$_comment',
`imagelocation`='$location'";
if (!mysql_query($sql))
{
die('Error: ' . mysql_error());
}
mysql_close($con);
}
Bookmarks