Run a php file from within mydbr

(4 posts) (2 voices)

Tags:

  1. ajdjackson, Member

    Hi

    Me again - sorry.

    I've written a image file uploader in php and I'm wondering if I can integrate this within mydbr.

    At present I have the following which calls the php file:

    select 'dbr.html', '<head> <title>A web page that points a browser to a different page after 2 seconds</title> <meta http-equiv="refresh" content="2; URL=http://xxx.xxx.com/mydbr/user/image_uploader_test.php"> <meta name="keywords" content="automatic redirection"> </head> <body> If your browser doesn\'t automatically go there within a few seconds, you may want to go to the destination manually. </body>';

    The problem with this when the file has been uploaded there is no way back to mydbr other than redirect via a url call as the mydbr header is gone along with it look and feel. Hope you follow that.

    I can't just use dbr.html for the php code as I have a block of code that connects to the db to populate a select list. Maybe there's a way to do this.

    The php file's code is:

    <div style="width: 50%; margin: 0 auto;"> <h2>Image Upload</h2> <form method="post" action="uploadimg.php" enctype="multipart/form-data"> Select Site: <select name="image_site">'; <?php

    $link=mysql_connect(localhost, $mysqlusername, $mysqlpassword) or die ("Error connecting to mysql server: ".mysql_error());

    mysql_select_db($dbname, $link) or die ("Error selecting specified database on mysql server: ".mysql_error());

    $imgquery="SELECT Site_Name FROM tblsitesjake where Site_Status = 'Active' order by Site_Name"; $imgresult=mysql_query($imgquery) or die ("Query to get data from the table failed: ".mysql_error());

    while ($imgrow=mysql_fetch_array($imgresult)) { $imgSite=$imgrow["Site_Name"]; echo "<option> $imgSite </option>";

    }

    ?>

    </select>

    Select Type: <select name="image_ctgy"> <option value="Unit">Unit</option> <option value="Kitchen">Kitchen</option> <option value="Tile">Tiles</option> </select>

    Select Image File: <input type="file" name="userfile" size="40"> <input type="hidden" name="MAX_FILE_SIZE" value="10000000">

    <input type="submit" value="Upload"> </form> </div>

    Thanks again for any help

    Jake

  2. myDBR Team, Key Master

    Why not just open the image uploader in a new window? The user could just close the window after (s)he is done with it and you would not have to navigate back.

    Btw, try not to use mysql_ -functions as they are already removed from newest PHP releases. Use mysqli instead.

    --
    myDBR Team

  3. ajdjackson, Member

    Thanks for getting back.

    Really stupid question - how do you open the URL=http://xxx.xxx.com/mydbr/user/image_uploader_test.php automatically in a new window?

    What I would like is for the user to click the 'report' link in mydbr and the new window open with the uploader and mydbr window to remain at main page.

    Sorry for being a pest but it's these type of things that I get really stumped at.

    Cheers

    Jake

  4. myDBR Team, Key Master

    Use the target="_blank" attribute in the link.

    --
    myDBR Team


Reply

You must log in to post.