Jump to content

eyehawk78

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Posts posted by eyehawk78

  1. Hi sorry to bother you again but i ran your code and i recieved to warnings.

    Warning: fread(): supplied argument is not a valid stream resource in C:\unzipped\CPT 06\uploadpage.php on line 14

    Warning: fclose(): supplied argument is not a valid stream resource in C:\unzipped\CPT 06\uploadpage.php on line 16

    what do these warnings mean?

    The blob size is still 0 bytes in my database.
  2. I am trying to use a html upload field to allow users to submit images to me that will be placed in my sql data base.
    i have sorted out the vaildation and submits the name and size to the database, but i need help with actually submitting the image to the database as a BLOB

    so the code i have is:

    <HTML>
    <HEAD>

    <?php

    $error = "";
    $valid=0;

    $filename = $HTTP_POST_FILES['file']['name'];
    $filesize = $HTTP_POST_FILES['file']['size'];
    $filetype = $HTTP_POST_FILES['file']['type'];
    $filetempname = $HTTP_POST_FILES['file']['tmp_name'];


    if(!$filename == ""){
    if($filetype == "image/gif"){
    $error = "successful";
    $valid++;
    }
    else if($filetype == "image/x-png"){
    $error = "successful";
    $valid++;
    }
    else if($filetype == "image/pjpeg"){
    $error = "successful";
    $valid++;
    }
    else if($filetype == "image/bmp"){
    $error = "successful";
    $valid++;
    }
    else {
    $error = "Incorrect file type, please upload image files of type .gif .bmp .png or .jpeg";
    $valid=0;
    }
    $maxsize=65536;
    $minsize=1024;
    if($error == "successful"){
    if($filesize <= $minsize){
    $error = "The file is too small, when this logo is placed onto shirt it will be disorted";
    $valid=0;
    }
    else if($filesize > $maxsize){
    $error = "The file is too large";
    $valid=0;
    }
    else {
    $error = "The file was successfully uploaded";
    $valid++;
    }
    }

    if($valid==2){

    $dbUser="blahblah";
    $dbHost="blahblah";
    $dbName="blahblah";
    $dbPass="blahblah";

    $dbc=mysql_connect($dbHost,$dbUser,$dbPass);
    $selected=mysql_select_db($dbName,$dbc);

    $query1="INSERT INTO upload VALUES('', '$filename', '$filetype', '$filesize', [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]'this is were the blob field is in my database[!--colorc--][/span][!--/colorc--]')";
    if(mysql_query($query1)){
    $error == "Your file was successfully submitted";
    }
    else {
    $error == "Your file could not be submitted";
    }
    $valid=0;
    }
    $filename = "";
    $filesize = "";
    $filetype = "";
    $filetempname = "";
    }
    ?>

    </HEAD>
    <BODY>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
    <font face="Verdana" color="#000000" font size="2" >Choose a file to upload:<br></font>
    <input type="file" name="file">
    <input type="submit" name="submit" value="Submit">
    <br><br>
    <font face="Verdana" color="#000000" font size="2" ><?php print("$error</br>"); ?></font>
    </form>
    </BODY>
    </HTML>

    could any one help me please?
  3. I am trying to use a html upload field to allow users to submit images to me that will be placed in my sql data base.
    i have sorted out the vaildation and submits the name and size to the database, but i need help with actually submitting the image to the database as a BLOB

    so the code i have is:

    <HTML>
    <HEAD>

    <?php

    $error = "";
    $valid=0;

    $filename = $HTTP_POST_FILES['file']['name'];
    $filesize = $HTTP_POST_FILES['file']['size'];
    $filetype = $HTTP_POST_FILES['file']['type'];
    $filetempname = $HTTP_POST_FILES['file']['tmp_name'];


    if(!$filename == ""){
    if($filetype == "image/gif"){
    $error = "successful";
    $valid++;
    }
    else if($filetype == "image/x-png"){
    $error = "successful";
    $valid++;
    }
    else if($filetype == "image/pjpeg"){
    $error = "successful";
    $valid++;
    }
    else if($filetype == "image/bmp"){
    $error = "successful";
    $valid++;
    }
    else {
    $error = "Incorrect file type, please upload image files of type .gif .bmp .png or .jpeg";
    $valid=0;
    }
    $maxsize=65536;
    $minsize=1024;
    if($error == "successful"){
    if($filesize <= $minsize){
    $error = "The file is too small, when this logo is placed onto shirt it will be disorted";
    $valid=0;
    }
    else if($filesize > $maxsize){
    $error = "The file is too large";
    $valid=0;
    }
    else {
    $error = "The file was successfully uploaded";
    $valid++;
    }
    }

    if($valid==2){

    $dbUser="blahblah";
    $dbHost="blahblah";
    $dbName="blahblah";
    $dbPass="blahblah";

    $dbc=mysql_connect($dbHost,$dbUser,$dbPass);
    $selected=mysql_select_db($dbName,$dbc);

    $query1="INSERT INTO upload VALUES('', '$filename', '$filetype', '$filesize', [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]'this is were the blob field is in my database[!--colorc--][/span][!--/colorc--]')";
    if(mysql_query($query1)){
    $error == "Your file was successfully submitted";
    }
    else {
    $error == "Your file could not be submitted";
    }
    $valid=0;
    }
    $filename = "";
    $filesize = "";
    $filetype = "";
    $filetempname = "";
    }
    ?>

    </HEAD>
    <BODY>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
    <font face="Verdana" color="#000000" font size="2" >Choose a file to upload:<br></font>
    <input type="file" name="file">
    <input type="submit" name="submit" value="Submit">
    <br><br>
    <font face="Verdana" color="#000000" font size="2" ><?php print("$error</br>"); ?></font>
    </form>
    </BODY>
    </HTML>

    could any one help me please?
  4. hello, when i try to execute this script i get the error code
    Parse error: syntax error, unexpected $end in C:\wamp\www\directory\test2.php on line 117
    basically i just want the submitted form data to be passed into a database. could some offer another set of eyes to look over my code plz?

    <HTML>
    <HEAD>

    <?php
    function dbInsert(){

    if(IsSet($_POST['submit'])){

    $dbUser="99hawker";
    $dbHost="localhost";
    $dbName="tprint";
    $dbPass="wdh240288";


    $dbc=mysql_connect($dbHost,$dbUser,$dbPass);
    $selected=mysql_select_db($dbName,$dbc);

    $title=$_POST['Title'];
    $firstname=$_POST['first_name'];
    $lastname=$_POST['last_name'];
    $address1=$_POST['address1'];
    $address2=$_POST['address2'];
    $towncity=$_POST['towncity'];
    $countystate=$_POST['countystate'];
    $country=$_POST['country'];
    $postcodezip=$_POST['postcodezip'];
    $emailaddress=$_POST['EmailAddress'];


    $query1="INSERT INTO Customer_Info VALUES('$title', '$firstname', '$lastname', '$address1', '$address2', '$towncity', '$countystate', '$country', '$postcodezip', '$emailaddress')";

    if(mysql_query($query1)){
    print("succesful");
    }
    else{
    print("Failed");
    }

    }

    ?>
    </HEAD>
    <BODY>



    <FORM ACTION="<?php echo $_SERVER['PHP_SELF']; ?>" METHOD="POST">
    <table align="center" border="0" cellpadding="0" cellspacing="0" width="600"><tr valign="top"><tr>
    <td class="topSpacer" width="190"><img alt="" border="0" height="1" width="190"></td>
    <td class="topSpacer" width="6"><img alt="" border="0" height="1" width="6"></td>
    <td class="topSpacer" width="100%"><img alt="" border="0" height="1" width="1"></td>
    </tr>
    <tr>
    <td class="label"><label for="Title">Title:</label></td>
    <td width="6"><img alt="" border="0" height="1" width="6" name="Title"></td>
    <td align="left"><select>
    <option value="Mr">Mr</option>
    <option value="Mrs">Mrs</option>
    <option value="Miss">Miss</option>
    <option value="Dr">Dr</option></select>
    </tr>
    <tr>
    <td class="label"><label for="first_name">First Name:</label></td>
    <td width="6"><img alt="" border="0" height="1" width="6"></td>
    <td align="left"><input type="text" class="textLong" size="25" maxlength="32" name="first_name" value=""></td>
    </tr>
    <tr>
    <td class="label"><label for="last_name">Last Name:</label></td>
    <td width="6"><img alt="" border="0" height="1" width="6"></td>
    <td align="left"><input type="text" id="last_name" class="textLong" size="25" maxlength="64" name="last_name" value=""></td>
    </tr>
    <tr>
    <td class="label"><label for="address1">Address Line 1:</label></td>
    <td width="6"><img alt="" border="0" height="1" width="6"></td>
    <td align="left"><input type="text" id="address1" class="textLong" size="25" maxlength="100" name="address1" value=""></td>
    </tr>
    <tr>
    <td class="label"><label for="address1">Address Line 2:</label></td>
    <td width="6"><img alt="" border="0" height="1" width="6"></td>
    <td align="left"><input type="text" id="address2" class="textLong" size="25" maxlength="100" name="address2" value=""></td>
    </tr>
    <tr>
    <td class="label"><label for="Town/City">Town/City:</label></td>
    <td width="6"><img alt="" border="0" height="1" width="6"></td>
    <td align="left"><input type="text" id="Town/City" class="textLong" size="25" maxlength="100" name="towncity" value=""></td>
    </tr>
    <tr>
    <td class="label"><label for="County/State">County/State:</label></td>
    <td width="6"><img alt="" border="0" height="1" width="6"></td>
    <td align="left"><input type="text" id="County/State" class="textLong" size="25" maxlength="100" name="countystate" value=""></td>
    </tr>
    <tr>
    <td class="label"><label for="Postcode/ZIP">Postcode/ZIP Code:</label></td>
    <td width="6"><img alt="" border="0" height="1" width="6"></td>
    <td align="left"><input type="text" id="Postcode/ZIP" class="textLong" size="25" maxlength="100" name="postcodezip" value=""></td>
    </tr>
    <tr>
    <td class="label"><label for="Country">Country:</label></td>
    <td width="6"><img alt="" border="0" height="1" width="6"></td>
    <td align="left"><select name="country" size="1">
    (lots of countries)
    </select></td>
    </tr>
    <tr>
    <td class="label"><label for="EmailAddress">Email Address:</label></td>
    <td width="6"><img alt="" border="0" height="1" width="6"></td>
    <td align="left"><input type="text" id="EmailAddress" class="textLong" size="25" maxlength="100" name="EmailAddress" value=""></td>
    </tr>
    <tr>
    <td class="label"><label for="EmailAddress">Repeat Email Address:</label></td>

    line 117 <td width="6"><img alt="" border="0" height="1" width="6"></td>

    <td align="left"><input type="text" id="EmailAddress2" class="textLong" size="25" maxlength="100" name="EmailAddress2" value=""></td>
    </table>
    <input TYPE="submit" NAME="submit" VALUE="Proceed" STYLE="font-size:13pt; background-color:#3399FF; color:#000000" onClick="php dbInsert()">

    </FORM>
    </BODY>
    </HTML>

    n e help would be greatly appreiciated, cheers
×
×
  • 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.