Jump to content

camdagr81

Members
  • Posts

    43
  • Joined

  • Last visited

    Never

Everything posted by camdagr81

  1. It would really depend on the instance and use of the file. If the file is an image, sure, it's probably better to just store the file locally, but if the file is mirrored, or needed on multiple hosts, I would think storing it in the db would be more practical. A lot of hosting packages offer unlimited db yet limited file storage. Use the db space instead of your precious script space It's also easier and faster to back up/export a db than it is to move an entire directory from one place to another (which i've learned the hard way when a host i was using decided to pack up and call it quits).
  2. try changing the field type to LONGTEXT instead of a blob. You should be able to have the same performance level w/o having to change any of your insert commands. This will also make the field fulltext so you should be able to search it. With blob, the encoding is different, thus not searchable w/o changing the encoding of your LIKE.
  3. here's an awesome class that makes it really easy to impliment pdf's into almost any code. http://www.ros.co.nz/pdf
  4. Loading files into a database is a great idea, it takes less space on the server (especially if you're skilled enough to gzip the file at runtime). Why are you against it?
  5. oops light error :-\ Try using this as your upload function: function upload_file() { // Check to see if the file has been uploaded to the server if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { // get the file name from the form and replace spaces with underscore '_' $file = str_replace(' ', '_', $_FILES['userfile']['name']); // Set the save to directory $saveto = '../../Index/imazhe/'; // Copy the file from the servers temp directory to your sites directory if (copy($_FILES['file']['tmp_name'], $saveto . $file)) { // If successful -> echo upload message and exit function echo "Imazhi $filename u upload-ua me sukses.<BR>"; return; } // If unable to copy send error message and exit the function else { echo "Nuk mund të kopjojë $userfile_name tek $file."; return; } }// end if_uploaded_file(); // Send Error message if unable to upload file else { echo "ERROR UPLOADING FILE"; return; } }// end upload_file() Sorry it took me so long to get back to you, I needed to eat
  6. Your file upload function should look something like this. function upload_file() { // Check to see if the file has been uploaded to the server if (is_uploaded_file($_FILES['file']['tmp_name'])) { // get the file name from the form and replace spaces with underscore '_' $file = str_replace(' ', '_', $_FILES['file']['name']); // Set the save to directory $saveto = '/your_upload_dir/'; // change the dir properties // Everything for owner, read and execute for others chmod($saveto, 0755); // Copy the file from the servers temp directory to your sites directory // If successful -> echo upload message and exit function if (copy($_FILES['file']['tmp_name'], $saveto . $file)) { return "Successfully Uploaded $file"; } // If unable to copy send error message and exit the function else { return "Unable to copy file to: '$saveto'"; } }// end if_uploaded_file(); // Send Error message if unable to upload file else { return "Unable to upload file: '$file'"; } }// end upload_file()
  7. Try using this as your upload function: function upload_file() { // Check to see if the file has been uploaded to the server if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { // get the file name from the form and replace spaces with underscore '_' $userfile = str_replace(' ', '_', $_FILES['userfile']['name']); // Set the save to directory $saveto = '../../Index/imazhe/'; // Copy the file from the servers temp directory to your sites directory if (copy($_FILES['file']['tmp_name'], $saveto . $file)) { // If successful -> echo upload message and exit function echo "Imazhi $filename u upload-ua me sukses.<BR>"; return; } // If unable to copy send error message and exit the function else { echo "Nuk mund të kopjojë $userfile_name tek $userfile."; return; } }// end if_uploaded_file(); // Send Error message if unable to upload file else { echo "ERROR UPLOADING FILE"; return; } }// end upload_file() Sorry it took me so long to get back to you, I needed to eat
  8. No problem I'm sure the problem is that you're not copying the file from the temp directory of the host. If you take a look at the upload_copy_file() function i posted here above, you can see how it takes the http post info and determines if the file has been uploaded. Also, in your upload form, do you have the: enctype="multipart/form-data" tag included? The file will not send to the server if it isn't present. If you want, i can take a look at your entire script and try to debug it for you (I'm avoiding doing my own work at the moment.. teehee).
  9. I'm not sure about this, but i think the browser's (firefox) cookie settings superceed the cookie expiration.
  10. you should be able to, is your script checking for is_uploaded_file() anywhere? That will tell you if the file is even being uploaded to your host.
  11. Yeah, you have to send a variable to the session in order for it to truely exsist: $_SESSION['var'] = 'value';
  12. are you copying the file to a directory? What does your upload script look like? function upload_copy_file() { if (is_uploaded_file($_FILES['file']['tmp_name'])) { $file = $_FILES['file']['name']; $path = '/uploads/' . $file; if (copy($_FILES['file']['tmp_name'], $path)) { return 1; } else { return 2; } } else { return 3; } }
  13. you may want to buffer the output. You can do this by adding: <?php ob_start(); As your first line of code.
  14. Check the permissions of the folder you are saving the file to. Make sure that it is writeable. Also check the max upload size. You maybe exceeding your limit.
  15. My machine is behind an ISA Server. The MySQL db is also behind the same ISA Server. I'm having trouble connecting to the MySQL db. If I connect to the db from an external IP, it works fine. I've attached a flow chart to better explain my situation. If anyone out there knows of a way to connect to mysql through a proxy, please help me out!!!!
  16. you may want to enclose the username field as well: $sql="SELECT * FROM `users` WHERE `username`= '$username' AND `password`= '$password' LIMIT 1"; then check : $error = mysql_error(); if ($error) { return $error; } else { $rows = mysql_num_rows($result); if ($rows > 0) { //your command } }
  17. Have you tried buffering the output ? If there is any HTML or anything echoed to the browser before the header() call, the header will not redirect (becasuse at that point the header has been sent to the browser). Try adding: ob_start(); to he first line of your script. And also check any required/included scripts to make sure they do not echo or print anything to the browser before your header() call.
×
×
  • 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.