T
tinsel_mb

  • Jun 26, 2012
  • Joined Jun 22, 2012
  • thanks all! your answers have helped me. i will use const.

    • hi

      I have a config.php file which i use to store reusable functions.

      I would like to declare some global variables in this file and use them in my other PHP files which include config.php.

      These variables will store values such as the directory path where I want to store attachments or the sender email address for my automatic email feature, etc.

      The values of these variables will not be modified by the other PHP files but their values need to be set in a single place for easy maintainance.

      How can i achieve this please?

      • thanks Weedpacket.

        i need to check that again because the first time i think i didn't like the look and feel in Firefox. i want the page to look neat and also i must be able to post up to 3 attachments. i will look into that option again and revert back if it's not ok.

        • thanks Weedpacket - it works now!

          i used the following command:
          copy($_FILES[$file_obj_name]["tmp_name"], $target_path . iconv("UTF-8", "ISO-8859-1//TRANSLIT", $filename));

          ISO-8859-1 works for French accents.

          • I actually want to change the formulation of this post.

            I've read already that there are some security issues in Firefox which prevent the use of file:// to access files stored on local hard drive.

            So i'm actually looking for the proper way to implement what i want.

            This is what i want:
            1. I want users to be able to upload a file attachment on the server
            2. I want them to be able to save or view the uploaded file via a URL on the page

            What is the best way to make this work on Firefox please?

            • I have another issue.

              I use the following command to copy files in my PHP file.
              copy($_FILES[$file_obj_name]["tmp_name"], $target_path . $filename);

              I then display the uploaded file as follows on the HTML page.
              echo "<a href='file://" . $file_url . "'>" . $file . "</a>";

              When i hover over the hyperlink the file path looks OK but when i click on the hyperlink nothing happens, i.e. the file does not open and i don't get the "Do you want to save or open" prompt which i usually get on other sites.

              I've tried this in IE 9 (my default browser) and Firefox 12.0 (i'm not sure if this is the correct version number but it's what i see when i do Help -> About Firefox) and neither one works. I need to make my website work mostly in Firefox.

              Can you plz help?

              • hello all
                i'm using the PHP copy command to implement an "upload attachment" functionality in a HTML form.
                my problem is that the user is allowed to upload filenames containing special characters, e.g. French accents.
                when i use the following command though the special character in the filename is replaced in the new directory.
                is there any way i can stop this from happening?
                btw i'm using Windows 7.

                PHP command:
                copy($_FILES[$file_obj_name]["tmp_name"], $target_path . $filename);

                original filename:
                Régularisation.docx

                new filename (conversion done during PHP copy):
                Régularisation