Jump to content

counterbeing

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

counterbeing's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm wondering if there is some way resize images and then upload via ftp through the browser. What I mean, is a site that allows you to choose images for upload, but on the client side changes their dimensions. Also, is it possible to use FTP to do this, I know it is often faster. I realize this is not a PHP question, but I was hoping someone could point me sniffing in the right direction. Thanks.
  2. You pretty much rock. Thanks. Is the "@" symbol a good idea? I've heard you should never have to use it. Thanks.
  3. [code] mysql_query('UPDATE `images` SET `group` = \'misc.\' WHERE `group`=\'$del\''); [/code] I've been looking over my code and determined that this is the line that is not working. Things don't seem to make sense sometimes when things are being inserted into a mysql_query. I assume it must have to do with my variable. Just before this code I am editing things in the same database but a different table, so I am definately connected properly... Any help is always appreciated. Thanks. Also... can anyone point me to some simple rules regarding quotes inside queries?
  4. Bholbrook: thank you very much... that helped. I obviously have some other things to work out but that was a huge stumbling block for me. I guess I didn't have a great understanding of the "select" statement. Barand: register_globals is on. Unfortunately I don't have a choice on that, it's not my server. On the fortunate side; this is only to be used by the client, and will be protected by a .htaccess file. There's no real security risk for this client. As for the reference to the file, I am applying the $id variable to each jpg file that is uploaded (i have yet to limit it to just jpg files, but will do that too.) as the title. I then recall the file for display by constructing the file name of $id.jpg. The $group variable will be defined in a form that accesses a different table in my database, exclusively for groups (which are intended to be sort of like photo albums albums). Thank you very much for the help. I always appreciate it. C
  5. Let me preface this by saying: I know very little. I do think what you're describing is possible by using mostly javascript. Here is a site that details using alerts with cancel button. [url=http://www.jsmadeeasy.com/javascripts/Alert%20Scripts/confirm%20cancel%20new%20window/index.htm]http://www.jsmadeeasy.com/javascripts/Alert%20Scripts/confirm%20cancel%20new%20window/index.htm[/url]
  6. I'm actually dealing with a similar issue. I decided that it would be best just to not use the autonumber feature and use php to generate an ID based on how many rows there were. I'm no veteran but that seems like an easy solution. Good Luck C
  7. Hi. I am relatively new to PHP. Thus far I have done a few small projects. I am currently working on one for uploading photoghaphs via POST, scaling them to size, and publishing them to a website. This tool is intended for potential clients to be able to update the photos section of their website themselves. If this is the right place, and nobody has any objections, I would like to post my project, as far as I am, and hear some suggestions to clean it up. I currently have  a bit of a bug when I am adding an image. I have to refresh the page before it shows up. It would make sense that I placed something out of order... but I'm through editing the mysql before I have to recall it at all. I can't quite understand why it doesn't show up. Also when the database is empty it struggles and pops out errors. I've been trying to keep it all on one page, which doesn't make it look very manageable, but it is. It connects to a mysql database to store information, such as ID (just a call number that will also be applied to the uploaded image), caption (allowing captions to be recalled later), and group (allowing images to be grouped and displayed by event or theme. [code] <?php $uploadDir = getcwd()."/uploaded/"; //set up general info for re-use $host = "localhost"; $user = "michaelp_admin"; $database = "michaelp_images"; $password = "••••••"; $link = mysql_connect( $host , $user , $password); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db($database) or die( "Unable to select database"); //end select connect $table = "images"; if($_GET["del"] !== null){ unlink("$uploadDir$del.jpg"); $delSQL = "DELETE FROM $table WHERE id=$del"; mysql_query($delSQL); } $query = "SELECT * FROM $table"; $result1 = mysql_query($query); $num = mysql_numrows($result1); print "<h1>Num is the number of rows: $num<br>Result1 is: $result1</h1><br>"; $id = $num; $file = $_FILES['userfile']; // put file in its correct place if($file['size'] > 0){ if(! is_uploaded_file($file['tmp_name'])){ die('File is not authentic.'); } $fileName = basename($file['name']); $uploadFile = "$uploadDir$id.jpg"; if (move_uploaded_file($file['tmp_name'], $uploadFile)){ $insertSQL = "INSERT INTO `images` (`id`, `cap`, `group`) VALUES ('".$id."', '".$caption."' , '".$group."')"; $result = mysql_query($insertSQL); echo "File: ". $fileName ." uploaded successfully.\n <br><br>"; $num++; } } //Display Data if(0 < $num) { $i=0; while ($i< $num) { $id=mysql_result($result1,$i,"id"); $caption=mysql_result($result1,$i,"cap"); $group=mysql_result($result1,$i,"group"); echo "<a href='./index.php?del=$id'>delete</a><br> id: $id<br>caption: $caption <br>group: $group<br>num: $num<br><hr>"; $i++; } } //close that shiz mysql_close($link); ?> <br> <!-- The data encoding type, enctype, MUST be specified as below --> <form enctype="multipart/form-data" action="index.php" method="POST">     <!-- MAX_FILE_SIZE must precede the file input field -->     <input type="hidden" name="MAX_FILE_SIZE" value="300000" />     <!-- Name of input element determines name in $_FILES array -->     Send this file: <input name="userfile" type="file" />     <br> Caption: <input name="caption" type="text" maxlength="200" >     <? echo '<input name="id" type="hidden" value="$id">'; ?>     <input type="submit" value="Send File" /> </form> [/code] Thanks a Bunch. If I am posting this in the wrong place let me know and I"ll move it. C.
×
×
  • 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.