PHP - Even Deleting My Image In The Server Its Showing?
Hi,
I deleted my image in the server folder, but still my image is showing, what might be the problem, Confused, I have cleared my browser cache and restarted, but nothing helps me, if anyone have idea about this pls share with me Thanks, Similar TutorialsCan someone tell me how I can remove or delete an image from a folder on a server using PHP? I tried this: Code: [Select] unlink("http://midwestcreativeconsulting.com/jhrevell/wp-content/themes/twentyten_3/upload/" . $location); before my delete MySQL statement, but I keep getting this error: Warning: unlink() [function.unlink]: http does not allow unlinking in /home/midwestc/public_html/jhrevell/wp-content/themes/twentyten_3/removejewelry.php on line 22 Can anyone help and tell me how I can make it work? I have a bad way with words, so if the title doesnt make much sense nor my post, I apolagize! But I am using a while loop and mysql_fetch_array to echo all information in a table in mysql. With each entry, I have included a button that executes a delete query for that entry. Code: [Select] $delquery="DELETE FROM requests WHERE user = '".$row['user']."'"; mysql_query($delquery,$link2); echo "<font size='19px' color='#009933'>User deleted from request database.When I click the button, the message is echod in every entry listed on the page, and nothing happens. I figured Id use delete from the username, so that way mysql will know which one to delete... but Idk when I think about it thats dumb and makes no sense. Im stuck. This side of the application im trying to make is the admin side where I can process requests. After I process the request I delete it from the database so I know I processed it. I have no idea what query to use for this. Anybody know how I could do this? Thanks I have a question regarding my email form submission. The email seems to work fine, but the recipient of the email can view my server information (see attached image for example) there are many website hosted on my server and i would like to hide the server info on form submissions. does anyone know of a way to do this? thanks Hello I am having problems uploading an image through a HTML form. I want the image to be uploaded to the server and the image name to be written to the mysql database. Below is the code I am using: Code: [Select] <?php if (isset($_POST['add'])){ echo "<br /> add value is true"; $name = $_POST['name']; $description = $_POST['description']; $price = $_POST['price']; $category_id = $_POST['category_name']; $image = $_FILES['image']['name']; //file path of the image upload $filepath = "../images/"; //mew name for the image upload $newimagename = $name; //new width for the image $newwidth = 100; //new height for the image $newheight = 100; include('../includes/image-upload.php'); mysql_query("INSERT INTO item (item_name, item_description, item_price, item_image) VALUES ('$name','$description','$price','$image')"); ?> Here is the image-upload.php file code: Code: [Select] <?php //assigns the file to the image $image =$_FILES["image"]["name"]; $uploadedfile =$_FILES["image"]["tmp_name"]; if ($image) { //retrieves the extension type from image upload $extension = getextension($image); //converts extension to lowercase $extension = strtolower($extension); //create image from uploaded file type if($extension=="jpg" || $extension=="jpeg") { $uploadedfile = $_FILES['image']['tmp_name']; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png") { $uploadedfile = $_FILES['image']['tmp_name']; $src = imagecreatefrompng($uploadedfile); }else{ $src = imagecreatefromgif($uploadedfile); } //creates a list of the width and height of the image list($width,$height)=getimagesize($uploadedfile); //adds color to the image $tmp = imagecreatetruecolor($newwidth,$newheight); //create image imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); //set file name $filename = $filepath.$newimagename.".".$extension; $imagename = $newimagename.".".$extension; //uploads new file with name to the chosen directory imagejpeg($tmp,$filename,100); //empty variables imagedestroy($src); imagedestroy($tmp); } ?> Any help would be appreciated, fairly new to all this! Thanks!!! I'm having an issue with an image not showing up using firefox. All other major browsers work. Query: $imgpath=(mysql_result($result,0,"imgpath")); Below is the code to display the image: <img alt="" height="210" width="709" src="<?php echo $imgpath; ?>"/> Any suggestions will be appreciated. Can anyone see anything wrong with this? <?php $filename = "aircraft/".$reg."1.jpg"; ?> Its meant to be aircraft/xxx1.jpg Thanks This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=314084.0 hey, i'm trying to add a watermark to pictures that show up, however it is only showing as text here is the code $watermark = imagecreatefrompng('watermark1.png'); $image = imagecreatefromjpeg("/userImages/big/".$pic); imagecopymerge($image, $watermark, 5, 5, 0, 0, 135, 35, 100); imagejpeg($image); imagedestroy($image); imagedestroy($watermark); also, where i fould how to do this, said u have to put a header('content-type: image/jpeg'); code at the top of the page or else it would read as text, however, when i do that, the whole page disappears except for a question mark thing indicating a picture should be there? what do i do?? I have a PHP script that locates a photo in a MySQL database and based on the path /filename stored in the database, retrieves the file and downloads it via the browser, the problem is that it saves as a filename that is the url with no extension. so we pass : dlfile.php?id-10 the script is supposed to get the filename from the stored file and download it with that filename but it downloads the file as 'dlfile?id=10' instead of PIC76534.jpg. where am i going wrong? code below for dlfile.php. or is there a way to ask the user to select a filename when downloading? I know the script is crude but have had it for ages. <?php require( '../js/db.php' ); $id = $_GET[ 'id' ]; $sql = "SELECT * FROM image_archive WHERE id = " . $id; $result = mysqli_query( $conn, $sql ); if ( !$result ) { echo "ERROR: " . mysqli_error( $conn ); } else { $row=mysqli_fetch_assoc($result); //path to the picture you're wanting the viewer to download $path = "/archimages/".basename($row['pic_OriginalPath']); if ( file_exists( $path ) ) { //split the extension and name from eachother $e = explode( '.', $path ); //get the name of the file $file_name = $e[ 0 ]; //image extension $extension = $e[ 1 ]; // Send a header saying we'll be displaying a picture header( 'Content-type: '.$row['pic_Type'] ); // Name the file header( 'Content-Disposition: attachment; filename="' . $file_name . $extension . '"' ); // Path to the picture you're wanting the user/viewer to download readfile( $file_name . '.' . $extension ); } else { echo 'The requested image does not exist.'.$path.'<hr>'; } } ?>
Hi there! im new to php , im having problem when upload image to server. Hope somebody can help me. i upload picture in admin CMS, the pic able to save in mysql but is not save in my server, the script below : Code: [Select] $catImage = uploadImage('fleImage', SRV_ROOT . 'images/category/'); i have check the folder/directory name all correct but the picture wont save in my server images folder & i try this script but not working as well: Code: [Select] $target_path = "images/category/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); i got this tutorial from : http://www.phpwebcommerce.com/ Thank You In Advance Hi guys, I have a page that lets you upload an image to a an ftp server. Now I am trying to create a page that will get those images and display them in a web page. I am trying to do this with php. Does anyone know if it can be done? Thanks guys, Hello I have uploaded images from a server onto a website, they run through a mysql database (database holds the image file names). The problem I am having is resizing the images. Can anyone help? Thank you in advance GWG I need to upload an image using php and store the image as blob in mysql. I understand the standard way is to create a form for the user, let the user choose the image to upload, click submit. But I need to create a php, for example, uploadImage.php?image="c:\myPhoto.jpg" and when I type http:\\www.myhome.com\uploadImage.php?image="c:\myPhoto.jpg" from a web browser in my pc, I can automatically upload myPhoto.jpg to the myhome.com server? Thank you for your kind help. Code: [Select] echo '<img src="data:image/jpg/png/jpeg;base64,' . base64_encode( $row['image'] ) . '" height="150" />'; This is showing up images great in firefox, safari and chrome, but in internet explorer it shows a nice red cross, and I assume it is because of the encoding? Does anyone know how to get working in internet explorer as well? Pretty urgent job! Much appreciated for your help! Hiya all, Firstly thanks for the previous help with the arrays and that... you guys (or girls) ROCK ! But now I am stuck... lol. I am creating a simple motor dealer script for a friend with a garage and a few cars. The idea is... they fill in the form... upload the image(s) and then it adds it in to the database and displays the info on the page with other cars. So far I have got it to array all the info in the database how I want (thanks to you lot !). Now I need to add another box on the add vehicle page to upload photos and then on the show vehicles page I need it to show the uploaded photos next to the vehicles info. This is what I have so far: showvehicles.php: <HTML> <HEAD> <TITLE>Barry Ottley Motor Co - Quality Used Motors - Stanford-Le-Hope, Essex</TITLE> </HEAD> <BODY LINK="#000000" ALINK="#000000" VLINK="#000000"> <CENTER><IMG SRC="logo.jpg"></CENTER> <CENTER> <TABLE WIDTH="840" CELLPADDING="0" CELLSPACING="0" BORDER="0"> <TR> <TD WIDTH="186" valign="top"> <BR> <CENTER><A HREF="index.html"><IMG SRC="homepage.jpg" alt="Homepage" border="0"></A></CENTER> <CENTER><A HREF="showroom.php"><IMG SRC="showroom.jpg" alt="Our Online Showroom" border="0"></A></CENTER> <CENTER><A HREF="location.html"><IMG SRC="ourlocation.jpg" alt="Our location" border="0"></A></CENTER> <CENTER><A HREF="aboutus.html"><IMG SRC="aboutus.jpg" alt="About Us" border="0"></A></CENTER> <CENTER><A HREF="contactus.php"><IMG SRC="contactus.jpg" alt="Contact Us" border="0"></A></CENTER> </TD> <TD WIDTH="30" valign="top"> </TD> <TD valign="top"> <FONT SIZE="2" FACE="ARIAL"> <CENTER><B>Current Showroom</B></CENTER> <BR> <!-- VIEWING BIT --> <?php include('dbconnect.php') ?> <?php // Make a MySQL Connection $query = "SELECT * FROM cars"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo "<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH=100% BORDER=0>"; echo "<TR />"; echo "<TD WIDTH=30% VALIGN=TOP />"; echo " <IMG SRC=immg.gif /> "; echo "<br />"; echo "</TD>"; echo "<TD WIDTH=10 VALIGN=TOP />"; echo " "; echo "</TD>"; echo "<TD />"; echo "<font size=3 face=arial /><B >"; echo $row['CarPrice']; echo "</B><font size=2 face=arial />"; echo "<br />"; echo $row['CarTitle']; echo "<br />"; echo "Vehicle Type: "; echo $row['CarName']; echo "<br />"; echo "Vehicle Mileage: "; echo $row['CarMiles']; echo "<br />"; echo "Description: "; echo "<br />"; echo "<br />"; echo $row['CarDescription']; echo "<br />"; echo "</TD>"; echo "</TR>"; echo "</TABLE>"; echo "<hr WIDTH=100% COLOR=BLACK />"; } ?> <!-- END OF VIEWING BIT --> </TD> </TR> </TABLE> <BR><BR><BR><BR> <CENTER><FONT FACE="VERDANA" SIZE="1"> This website was designed and is hosted by <A HREF="http://www.IRCDirect.co.uk">IRC Direct Website Design™</A> 2010 </CENTER> <BR> <CENTER><A HREF="admin.php">Employee Area</A> </BODY> </HTML> AddVehicle.php <HTML> <HEAD> <TITLE>Barry Ottley Motor Co - Quality Used Motors - Stanford-Le-Hope, Essex</TITLE> </HEAD> <BODY LINK="#000000" ALINK="#000000" VLINK="#000000"> <CENTER><IMG SRC="logo.jpg"></CENTER> <CENTER> <TABLE WIDTH="840" CELLPADDING="0" CELLSPACING="0" BORDER="0"> <TR> <TD WIDTH="186" valign="top"> <BR> <CENTER><A HREF="index.html"><IMG SRC="homepage.jpg" alt="Homepage" border="0"></A></CENTER> <CENTER><A HREF="showroom.php"><IMG SRC="showroom.jpg" alt="Our Online Showroom" border="0"></A></CENTER> <CENTER><A HREF="location.html"><IMG SRC="ourlocation.jpg" alt="Our location" border="0"></A></CENTER> <CENTER><A HREF="aboutus.html"><IMG SRC="aboutus.jpg" alt="About Us" border="0"></A></CENTER> <CENTER><A HREF="contactus.php"><IMG SRC="contactus.jpg" alt="Contact Us" border="0"></A></CENTER> </TD> <TD WIDTH="30" valign="top"> </TD> <TD valign="top"> <FONT SIZE="2" FACE="ARIAL"> <CENTER><B>Add a Vehicle</B></CENTER> <BR> <form action="inserts.php" method="post"> <CENTER>Vehicle Name:</CENTER> <CENTER><input type="text" name="CarName"></CENTER> <br> <CENTER>Vehicle Type:</CENTER> <CENTER><input type="text" name="CarTitle"></CENTER> <br> <CENTER>Vehicle Price:</CENTER> <CENTER><input type="text" name="CarPrice"></CENTER> <br> <CENTER>Vehicle Mileage:</CENTER> <CENTER><input type="text" name="CarMiles"></CENTER> <br> <CENTER>Vehicle Description:</CENTER> <CENTER><textarea name="CarDescription" rows="10" cols="30"></textarea></CENTER> <br> <CENTER><input type="Submit"></CENTER> </form> </TD> </TR> </TABLE> <BR><BR><BR><BR> <CENTER><FONT FACE="VERDANA" SIZE="1"> This website was designed and is hosted by <A HREF="http://www.IRCDirect.co.uk">IRC Direct Website Design™</A> 2010 </CENTER> <BR> <CENTER><A HREF="admin.php">Employee Area</A> </BODY> </HTML> inserts.php (Actually handles adding info to the database thats been typed in form) <HTML> <HEAD> <TITLE>Barry Ottley Motor Co - Quality Used Motors - Stanford-Le-Hope, Essex</TITLE> </HEAD> <BODY LINK="#000000" ALINK="#000000" VLINK="#000000"> <CENTER><IMG SRC="logo.jpg"></CENTER> <CENTER> <TABLE WIDTH="840" CELLPADDING="0" CELLSPACING="0" BORDER="0"> <TR> <TD WIDTH="186" valign="top"> <BR> <CENTER><A HREF="index.html"><IMG SRC="homepage.jpg" alt="Homepage" border="0"></A></CENTER> <CENTER><A HREF="showroom.php"><IMG SRC="showroom.jpg" alt="Our Online Showroom" border="0"></A></CENTER> <CENTER><A HREF="location.html"><IMG SRC="ourlocation.jpg" alt="Our location" border="0"></A></CENTER> <CENTER><A HREF="aboutus.html"><IMG SRC="aboutus.jpg" alt="About Us" border="0"></A></CENTER> <CENTER><A HREF="contactus.php"><IMG SRC="contactus.jpg" alt="Contact Us" border="0"></A></CENTER> </TD> <TD WIDTH="30" valign="top"> </TD> <TD valign="top"> <FONT SIZE="2" FACE="ARIAL"> <CENTER><B>Vehicle Added</B></CENTER> <BR> <?php mysql_connect("localhost", "wormste1_barry", "barry") or die(mysql_error()); mysql_select_db("wormste1_barry") or die(mysql_error()); $CarName = mysql_real_escape_string(trim($_POST['CarName'])); $CarTitle = mysql_real_escape_string(trim($_POST['CarTitle'])); $CarPrice = mysql_real_escape_string(trim($_POST['CarPrice'])); $CarMiles = mysql_real_escape_string(trim($_POST['CarMiles'])); $CarDescription = mysql_real_escape_string(trim($_POST['CarDescription'])); mysql_query("INSERT INTO cars (CarName, CarTitle, CarPrice, CarMiles, CarDescription) VALUES('$CarName', '$CarTitle', '$CarPrice', '$CarMiles', '$CarDescription' ) ") or die(mysql_error()); echo "The vehicle data has been added!"; ?> </TD> </TR> </TABLE> <BR><BR><BR><BR> <CENTER><FONT FACE="VERDANA" SIZE="1"> This website was designed and is hosted by <A HREF="http://www.IRCDirect.co.uk">IRC Direct Website Design™</A> 2010 </CENTER> <BR> <CENTER><A HREF="admin.php">Employee Area</A> </BODY> </HTML> If anyone can help me... much appreciated. I googled it and it started quoting BLOBS and stuff... i was confused i need to count the number of image files on a remote server not in my network. ive come across a suggestion to use
@getimagesize($img_url)the above works but is really slow. anyone able to suggest a better method? This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=326995.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=357605.0 I'm having a really hard time getting my carousel to display in a line when I call my images from the table:
<div id="user-gallery"> <h2>Recent Images</h2> <button class="prev"><<</button> <button class="next">>></button> <?php include("file/image/upload_file.php"); $select_query = "SELECT `images_path` FROM `images_tbl` ORDER by `images_id` DESC LIMIT 9"; $sql = mysql_query($select_query) or die(mysql_error()); while($row = mysql_fetch_array($sql,MYSQL_BOTH)){ ?> <div class="anyClass"> <ul> <li><img src="<?php echo $row["images_path"]; ?>" alt="" width="125" height="70" ></li> <li><img src="<?php echo $row["images_path"]; ?>" alt="" width="125" height="70" ></li> <li><img src="<?php echo $row["images_path"]; ?>" alt="" width="125" height="70" ></li> <li><img src="<?php echo $row["images_path"]; ?>" alt="" width="125" height="70"></li> </ul> </div> <?php } ?> </div>Without the carousel it will display perfectly, but as soon as I implement it, the images won't behave normal :/ $account="54646456456464"; $station= "12345"; $options="11-1"; $image="C:/Desktop/Sample Images/usco1.jpg"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://dfdgfsfs.com/kgdfgd.php"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, array( 'image' => '@'.$image, 'account' => $account, 'station' => $station, 'options' => $options)); $postResult = curl_exec($ch); curl_close ($ch); $xmlobj = simplexml_load_string($postResult); echo (string)$xmlobj->ID->attributes()->value; echo (string)$xmlobj->FullName->attributes()->value;All, I have spend days trying to figure this out without any luck. I am now in crisis mode. I need to get this working asap. The following code works perfect on my local xampp machine. As soon as I upload it to my web server, I don't get any data back. I have narrowed it down to the image i am trying to send is not being received properly. Thanks in advance. |