Hilfe bei Pictureuploadanpassung!

  • Hallo zusammen,
    ich bin weder Informatiker noch sonst gross technisch begabt, habe aber donnoch die Aufgabe vom Chef bekommen bei einer PHP Image Upload Seite sie so anzupassen, dass wenn man auf "Durchsuchen" klickt und dann ein Bild auswählt, welches später heraufgeladen wird, direkt mit diesem Namen dann auch in die Datenbank abgespeichert wird.
    Beim jetzigen Script muss man in ein saparates Feld Namen eingeben.
    Dh. das File kann lokal Hans.jpg heissen, aber wenn man in diesem separatem Feld Peter.jpg eingibt, wird es unter Peter.jpg gespeichert.

    Kann mir jemand helfen dieses separate Feld wegzumachen und dann anschliessen sagen, was ich machen kann, dass der Imagename automatisch übernommen wird???


    Hier die Scripts...

    1.Seite mit dem den Eingabefeldern usw:


    <title> CLCM Database</title><body bgcolor="#E7B725">
    <form name="form2" method="post" enctype="multipart/form-data" action="picupload.php">
    <?php include ("menu.php"); ?><map name="Map7">
    <area shape="rect" coords="0,1,156,23" href="eingabemaske.php">
    </map>
    <map name="Map11">
    <area shape="rect" coords="0,0,102,23" href="type.php">
    </map>
    <map name="Map12">
    <area shape="rect" coords="1,1,133,23" href="producer.php">
    </map>
    <map name="Map13">
    <area shape="rect" coords="2,1,104,24" href="user.php">
    </map>
    <map name="Map10">
    <area shape="rect" coords="1,0,314,27" href="change_details.php">
    </map>

    <map name="Map9">
    <area shape="rect" coords="0,1,312,27" href="add_data.php">
    </map>

    <map name="Map8">
    <area shape="rect" coords="1,1,190,26" href="add_comment_url.php">
    </map>


    <table width="80%" border="0" align="center">
    <tr>
    <td height="24"><div align="center"><font size="5" face="Verdana"><u>Add
    Picture to Standard:</u></font>
    </div></td>
    </tr>
    </table>

    <table width="50%" border="0" align="center">
    <tr>
    <td>If you do have a Picture for this device you are able to upload it here</td>
    </tr>
    <tr>
    <td>

    Use browse button and enter the new name of the file without extension
    in the second field.

    </p></td>
    </tr>
    <tr>

    </tr>
    </table>
    <table width="50%" border="0" align="center">
    <tr>
    <td width="31%" height="21" bgcolor="#FF6600">Upload a Picture </td>
    <td width="69%">
    <input type="file" name="uploadedfile" size="30"> </td>
    </tr>
    <tr>

    <td height="21"></td>
    <td><input type="text" name="picname" value="">
    <input type="hidden" name="max_file_size" value="100000"> <input type="hidden" name="func" value="two">
    <input type="hidden" name="id2" value="<?php print "$id"; ?>">
    <input type="hidden" name="time" value="<?php //definition of momental time and date
    $ret= time(); print gmdate ("F, d Y H:i" ); ?>">
    <input type="submit" value="Send"></td>


    </tr>
    </table>

    <table width="70%" border="0" align="center">
    <tr>
    <td><div align="center">Please consider that it is not possible to add more
    than one picture for each device.</div></td>
    </tr>
    </table>

    </p>
    </form>
    <map name="Map">
    <area shape="rect" coords="1,1,77,27" href="bye.php">
    </map>
    <map name="Map2">
    <area shape="rect" coords="1,1,31,38" href="bye.php">
    </map>


    2.Seite

    <title>Roche CLCM Database</title><body bgcolor="#E7B725">
    <?php

    //____________________________________________
    //START OF CONFIGURATION
    //____________________________________________
    //relative path from this script to folder where images must upload
    $dir='../pictures';
    //apsolut URL path from begin of your site
    $apsolut_dir="http://informatics.roche.com/pictures";
    //____________________________________________
    //END OF CONFIGURATION
    //____________________________________________

    //begin of code
    if (!$func) {
    $func = "one";
    }
    switch ($func) {
    case one:

    break;

    case two:
    //collect the name from POST VARS
    $ime="{$HTTP_POST_VARS['picname']}";
    //get type of file
    $ekst=$uploadedfile_type;
    //get lenght of image type
    $duzina=strlen($ekst);
    //get part of file image to build image extension
    $pos=strpos($ekst,"/")+1;
    //build extension of image
    $ekstenzija=substr($ekst,$pos,$duzina);
    //correct errors with some images
    //jpg
    if($ekstenzija=="pjpeg"){
    $ekstenzija="jpg";
    }
    //png
    if($ekstenzija=="x-png"){
    $ekstenzija="png";
    }
    //wmf
    if($ekstenzija=="x-wmf"){
    $ekstenzija="wmf";
    }
    //psd
    if($ekstenzija=="octet-stream"){
    $ekstenzija="psd";
    }
    //added in version 0.2
    //if the name is empty copy name of image from your HDD
    //that correct error if you do not enter new name of image
    if (!$ime)
    {
    $ime=$uploadedfile_name;
    }
    //build new name of name that you specified, . and extension of image
    else {
    $ime.=".".$ekstenzija;
    }
    //if image exist, upload it in correct dir and save to database
    $pic="http://informatics.roche.com/clcm/pictures/".$ime;

    //connect include
    include ("connect.php");

    //Insert Data into table....

    $s= OCIParse ($c, "UPDATE TBL_STANDARDS SET PIC='$pic' WHERE ID='$id2'");
    OCIExecute ($s, OCI_DEFAULT);

    //insert data into tbl_time to enter the date and time from this moment
    $s2= OCIParse ($c, "UPDATE TBL_TIME SET TIME='$time'");
    OCIExecute ($s2, OCI_DEFAULT);

    //commit to save changes...

    OCICommit ($c);

    if($uploadedfile<>"none") {
    if(!copy($uploadedfile,"$dir/$ime"))
    {
    //display errors
    print("Error: image did not send.
    ");
    print("Image is too big or it does not exist.
    ");
    print("Try again.");
    }
    //or finish

    else {

    //output
    print("Image has been sent.
    image location on server is: $apsolut_dir/$ime");
    }
    }
    break;

    }
    ?>
    <form name="form1" method="post" action="add_data.php">
    <input type="submit" name="Submit" value="go back to add more pictures">
    </form>

  • Habe zwar nicht viel Ahnung was du meinst, aber hier ist das wichtige.
    Wobei "picname" das Eingabefeld heisst in den man den neuen Namen eingeben muss. Und dieses muss ja weg...
    Wäre wirklich froh, wenn jemand mir helfen könnte, mache alles was ihr wollt und gebe alle Infos die ihr wollt....

    <?php

    //____________________________________________
    //START OF CONFIGURATION
    //____________________________________________
    //relative path from this script to folder where images must upload
    $dir='../pictures';
    //apsolut URL path from begin of your site
    $apsolut_dir="http://informatics.roche.com/pictures";
    //____________________________________________
    //END OF CONFIGURATION
    //____________________________________________

    //begin of code
    if (!$func) {
    $func = "one";
    }
    switch ($func) {
    case one:

    break;

    case two:
    //collect the name from POST VARS
    $ime="{$HTTP_POST_VARS['picname']}";
    //get type of file
    $ekst=$uploadedfile_type;
    //get lenght of image type
    $duzina=strlen($ekst);
    //get part of file image to build image extension
    $pos=strpos($ekst,"/")+1;
    //build extension of image
    $ekstenzija=substr($ekst,$pos,$duzina);
    //correct errors with some images
    //jpg
    if($ekstenzija=="pjpeg"){
    $ekstenzija="jpg";
    }

  • Ich hab mich bei Roche beworben und die haben mich nicht genommen da meine Leistungen wohl deren meinung nach nicht ihren Erwartungen entsprechen... naja, hätten sie besser mal :P

    Hier ein paar Hilfen:
    http://de3.php.net/manual/de/rese…variables.files
    http://de3.php.net/manual/de/feat…oad.post-method

    Was du suchst wäre dann die variable $_FILES['userfile']['name']

  • LOL...
    bin nicht Informatiker, sondern nur ein "Bürogummi", da mein Chef aber meinte ich sollte mir diesem Problem annehmen, da die Informatiker zu lange brauchen würden... :roll:

    FUCK...!!! Wenn jemand Zeit hat könnte, könnte er hier rein schreiben und man könnte über E-Mail kommunizieren...
    Bin wirklich am Ende!

  • *am Kopf kratzt*
    Ich frag mich echt, warum die meine Bewerbung abgelehnt haben...

    Ich hab nicht gedacht, dass du erwartest dass wir dir den ganzen Code schreiben :P

    Seite 1:
    [php:1:6d8874a238]

    <title>
    CLCM Database
    </title>
    <body bgcolor="#E7B725">
    <form name="form2" method="post" enctype="multipart/form-data" action="picupload.php">
    <?php include ("menu.php"); ?>
    <map name="Map7">
    <area shape="rect" coords="0,1,156,23" href="eingabemaske.php">
    </map>
    <map name="Map11">
    <area shape="rect" coords="0,0,102,23" href="type.php">
    </map>
    <map name="Map12">
    <area shape="rect" coords="1,1,133,23" href="producer.php">
    </map>
    <map name="Map13">
    <area shape="rect" coords="2,1,104,24" href="user.php">
    </map>
    <map name="Map10">
    <area shape="rect" coords="1,0,314,27" href="change_details.php">
    </map>

    <map name="Map9">
    <area shape="rect" coords="0,1,312,27" href="add_data.php">
    </map>

    <map name="Map8">
    <area shape="rect" coords="1,1,190,26" href="add_comment_url.php">
    </map>

    <table width="80%" border="0" align="center">
    <tr>
    <td height="24">
    <div align="center">

    <font size="5" face="Verdana">
    Add
    Picture to Standard:
    </font>

    </div>
    </td>
    </tr>
    </table>

    <table width="50%" border="0" align="center">
    <tr>
    <td>
    If you do have a Picture for this device you are able to upload it here
    </td>
    </tr>
    <tr>
    <td>


    Use browse button and enter the new name of the file without extension
    in the second field.

    </p>
    </td>
    </tr>
    <tr>
    </tr>
    </table>
    <table width="50%" border="0" align="center">
    <tr>
    <td width="31%" height="21" bgcolor="#FF6600">
    Upload a Picture
    </td>
    <td width="69%">
    <input type="file" name="uploadedfile" size="30">
    </td>
    </tr>
    <tr>
    <td height="21">
    </td>
    <td>
    <input type="hidden" name="max_file_size" value="100000">
    <input type="hidden" name="func" value="two">
    <input type="hidden" name="id2" value="<?php print "$id"; ?>">
    <input type="hidden" name="time" value="
    <?php //definition of momental time and date
    $ret= time(); print gmdate ("F, d Y H:i" );
    ?>
    ">
    <input type="submit" value="Send">
    </td>
    </tr>
    </table>
    <table width="70%" border="0" align="center">
    <tr>
    <td>
    <div align="center">
    Please consider that it is not possible to add more
    than one picture for each device.
    </div>
    </td>
    </tr>
    </table>


    </p>
    </form>
    <map name="Map">
    <area shape="rect" coords="1,1,77,27" href="bye.php">
    </map>
    <map name="Map2">
    <area shape="rect" coords="1,1,31,38" href="bye.php">
    </map>[/php:1:6d8874a238]

    Seite 2:
    [php:1:6d8874a238]<title>
    Roche CLCM Database
    </title>
    <body bgcolor="#E7B725">
    <?php
    //____________________________________________
    //START OF CONFIGURATION
    //____________________________________________
    //relative path from this script to folder where images must upload
    $dir='../pictures';
    //apsolut URL path from begin of your site
    $apsolut_dir="http://informatics.roche.com/pictures";
    //____________________________________________
    //END OF CONFIGURATION
    //____________________________________________
    //begin of code
    if (!$func) {
    $func = "one";
    }
    switch ($func) {
    case one:
    break;
    case two:
    //collect the name from POST VARS
    //$ime="{$HTTP_POST_VARS['picname']}";
    $ime = $_FILES['uploadedfile']['name'];
    //get type of file
    $ekst=$uploadedfile_type;
    //get lenght of image type
    $duzina=strlen($ekst);
    //get part of file image to build image extension
    $pos=strpos($ekst,"/")+1;
    //build extension of image
    $ekstenzija=substr($ekst,$pos,$duzina);
    //correct errors with some images
    //jpg
    if($ekstenzija=="pjpeg"){
    $ekstenzija="jpg";
    }
    //png
    if($ekstenzija=="x-png"){
    $ekstenzija="png";
    }
    //wmf
    if($ekstenzija=="x-wmf"){
    $ekstenzija="wmf";
    }
    //psd
    if($ekstenzija=="octet-stream"){
    $ekstenzija="psd";
    }
    //added in version 0.2
    //if the name is empty copy name of image from your HDD
    //that correct error if you do not enter new name of image
    if (!$ime)
    {
    $ime=$uploadedfile_name;
    }
    //build new name of name that you specified, . and extension of image
    else {
    //$ime.=".".$ekstenzija;
    }
    //if image exist, upload it in correct dir and save to database
    $pic="http://informatics.roche.com/clcm/pictures/".$ime;
    //connect include
    include ("connect.php");
    //Insert Data into table....
    $s= OCIParse ($c, "UPDATE TBL_STANDARDS SET PIC='$pic' WHERE ID='$id2'");
    OCIExecute ($s, OCI_DEFAULT);
    //insert data into tbl_time to enter the date and time from this moment
    $s2= OCIParse ($c, "UPDATE TBL_TIME SET TIME='$time'");
    OCIExecute ($s2, OCI_DEFAULT);
    //commit to save changes...
    OCICommit ($c);
    if($uploadedfile<>"none") {
    if(!copy($uploadedfile,"$dir/$ime"))
    {
    //display errors
    print("Error: image did not send.
    ");
    print("Image is too big or it does not exist.
    ");
    print("Try again.");
    }
    //or finish
    else {
    //output
    print("Image has been sent.
    image location on server is: $apsolut_dir/$ime");
    }
    }
    break;
    }
    ?>
    <form name="form1" method="post" action="add_data.php">
    <input type="submit" name="Submit" value="go back to add more pictures">
    </form>
    [/php:1:6d8874a238]

    Und sag mal den Informatikern, dass der Code den sie da Fabriziert haben zwar stupid aber nicht simple ist ;)

    Grausam...

  • Also eines ist sicher... ich werde nie wieder solche SCHEISS Arbeit annehmen... wie könnt ihr das? Ein Wunder, dass nicht mehr Informatiker amoklaufen!!!

    Modula
    Ich habe schon nicht erwartet, dass mir jemand den gesamter Code (oder für euch wahrscheinlich Script? :D ) schreibt, aber ich kam bei der Hilfe einfach nicht wirklich draus...
    Auf alle Fälle kommt, wenn ich die 2 Seiten ausführe beim klicken des "Send"-Buttons eine Fehlermeldung und zwar diese:

    Warning: OCIStmtExecute: ORA-01401: inserted value too large for column in /export/home/www/w2usr21/databasetool/picupload.php on line 72
    Image has been sent.
    image location on server is: http://informatics.roche.com/pictures/binaryworld.jpg

    und obwohl es heisst...
    image location on server is: http://informatics.roche.com/pictures/binaryworld.jpg
    ist's nicht "dort"...

    Auf alle Fälle schon jetzt vielen Dank und wenn du magst schreib mir doch ne PN, damit ich mich "erkenntlich" zeigen kann...

  • Zitat von Anonymous

    Auf alle Fälle schon jetzt vielen Dank und wenn du magst schreib mir doch ne PN, damit ich mich "erkenntlich" zeigen kann...

    Boah - jetzt bin ich neugierig ob Modula auch das hinbekommt, zutrauen würde ich es ihm ja ;)

    G.a.d.M.

    Ronald

  • Zitat von Ronald

    Boah - jetzt bin ich neugierig ob Modula auch das hinbekommt, zutrauen würde ich es ihm ja ;)

    Soviele Patrik K die bei Roche arbeiten wirds nicht geben - aber ob die die Adressen rausrücken wenn ich da anrufe und sage: "Hallo, ich bin von forum-hilfe.de und bräuchte mal die Adressen aller Mitarbeiter bei ihnen, deren Vorname patrik ist und deren Nachname mit K anfängt." ;)

    Zu deinem Problem:

    Ich bräuchte einmal die Zeilen 68 - 76 aus deiner picupload.php.

    Die Bilddatei müsste übrigens irgendwo auf dem Server liegen, vielleicht solltest du mal von hand danach suchen - weil sonst hätts script was anderes ausspucken müssen ;)

  • Zitat von Modula

    Soviele Patrik K die bei Roche arbeiten wirds nicht geben - aber ob die die Adressen rausrücken wenn ich da anrufe und sage: "Hallo, ich bin von forum-hilfe.de und bräuchte mal die Adressen aller Mitarbeiter bei ihnen, deren Vorname patrik ist und deren Nachname mit K anfängt." ;)

    Da mit kannst du ihm dann aber immer noch keine PN schicken, höchstens eine Mail ;)

  • hehe... ihr seid mir ja auch lustige Gesellen... :D

    Hier der Code:
    $s= OCIParse ($c, "UPDATE TBL_STANDARDS SET PIC='$pic' WHERE ID='$id2'");
    OCIExecute ($s, OCI_DEFAULT);
    //insert data into tbl_time to enter the date and time from this moment
    $s2= OCIParse ($c, "UPDATE TBL_TIME SET TIME='$time'");
    OCIExecute ($s2, OCI_DEFAULT);
    //commit to save changes...
    OCICommit ($c);
    if($uploadedfile<>"none") {
    if(!copy($uploadedfile,"$dir/$ime"))

    Das Bild ist wirklich nicht hochgeladen worden!!

  • Naja - ne google suche mit namen und adresse, dann findest sich sicherlich irgendwo ein forum ein chat oder sonstwas wo ich ne PN schreiben kann ;)

    [php:1:852e0a9f83]<?php
    // Das Bild aus dem Temporären verzeichnis in das Zielverzeichnis kopieren:
    if(!copy($_FILES['uploadedfile']['tmp_name'],"$dir/$ime"))
    {
    //display errors
    print("Error: image did not send.
    ");
    print("Image is too big or it does not exist.
    ");
    print("Try again.");
    }
    //or finish
    else {
    //output
    print("Image has been sent.
    image location on server is: $apsolut_dir/$ime");
    }

    ?>[/php:1:852e0a9f83]

    arbeite mal mit dem scriptteil statt "deinem" an der stelle...

  • Nächstes Problem...

    Parse error: parse error in /export/home/www/w2usr21/databasetool/picupload.php on line 89

    Hier Zeilen 83 bis 96...

    //display errors
    print("Error: image did not send.
    ");
    print("Image is too big or it does not exist.
    ");
    print("Try again.");
    }
    //or finish
    else {
    //output
    print("Image has been sent.
    image location on server is: $apsolut_dir/$ime");
    }
    }
    break;
    }
    ?>

  • PS. Soll ich ein Empfehlungsschreiben für dich bei der Informatikabteilung abliefern? Wär doch was, dann könnt ich dir ne Runde Kaffee spendieren...

  • jep, 89 ist else...

    nun müsste ich nur noch wissen in welcher Roche denn??? Regio Mannheim???


  • Eh bist noch da????
    Also, das Bilder heraufladen klappt nun doch(am Morgen war's ein Serverproblem), jedoch kommt folgende Fehlermeldung:
    Warning: OCIStmtExecute: ORA-01401: inserted value too large for column in /export/home/www/w2usr21/databasetool/picupload.php on line 72
    Image has been sent.
    image location on server is: http://informatics.roche.com/pictures/binaryworld.jpg

    Wieso es am Morgen nicht geklappt hat ist mir ein Rätsel, scheinbar gab's mit diesem FTP Server ein Problem, aber ansonsten keine Ahnung!

    Kann ich diese Fehlermeldung nicht einfach irgendwie ausblenden oder so :D ??

    Gruss

  • Also es klappt mit dem vorherigen geposteten Code, welcher du auf der ersten Seite einmal gepostet hast.

  • du kannst die fehlermeldung schon unterdrücken, aber dann würde der eintrag in der datenbank fehlen und das ist ja nicht sinn der sache.

    Den Fehler den du jetzt noch hast kann ich dir allerdings nicht beheben. für mich hört sich das so an als sei das Datenbankfeld für den $time Wert zu klein.

    hau mal über "//insert data into tbl_time to enter the date and time from this moment
    $s2= OCIParse ($c, "UPDATE TBL_TIME SET TIME='$time'");
    " ein "die($time);" rein und sag mir was du bekommst.

    BTW: ja, Mannheim ;)