Jump to content

vidyashankara

Members
  • Posts

    75
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

vidyashankara's Achievements

Member

Member (2/5)

0

Reputation

  1. i changed it to [code] $target_path = ""; [/code] because i changed to $time before itself. Works great now. Thanks :)
  2. index.php [code] echo "<p><img src=/images/part2index.jpg> <form enctype=multipart/form-data method=post action=upload.php> <input type=file name=file />   <input type=image src=/images/uploadindex.jpg value=Upload> </form>"; [/code] upload.php [code] ini_set("display_errors",1); $time=time(); // Where the file is going to be placed chdir("uploaded_pdb"); mkdir($time,0777); chdir($time); $target_path = "uploaded_pdb/$time/"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $filename = basename($_FILES['file']['name']); $target_path = $target_path . $filename; // This is how we will get the temporary file... $tmpname = $_FILES['file']['tmp_name']; $move = move_uploaded_file($tmpname, $target_path); if ($move) {     echo "The file $filename has been uploaded"; } else {     echo "There was an error uploading the file, $filename, please try again!"; } print "<pre>"; echo 'Here is some more debugging info:<br>'; print_r($_FILES); print "</pre>"; [/code] Output of array file [code] Array (     [file] => Array         (             [name] => 1.txt             [type] => text/plain             [tmp_name] => /tmp/phpyxLK1B             [error] => 0             [size] => 666         ) ) [/code] the error i get is [code] Warning: move_uploaded_file(uploaded_pdb/1154116683/1.txt): failed to open stream: No such file or directory in /var/www/html/pdbreader/upload.php on line 20 Warning: move_uploaded_file(): Unable to move '/tmp/phpyxLK1B' to 'uploaded_pdb/1154116683/1.txt' in /var/www/html/pdbreader/upload.php on line 20 There was an error uploading the file, 1.txt, please try again! [/code] whats wrong??? the code looks perfect to me...
  3. I have this function on my php script.. [code] echo " function add() { var i =1; var txt = \"SEGID : <select name='segid[]'>"; for ($i=0; $i<count($atm); $i++) { echo "<option value='PRO$atm[$i]'>PRO$atm[$i]"; } echo "</select>\"; txt +=\" Residue : <select name='resi[]'> <option value=ASP>ASP <option value=GLU>GLU <option value=LYS>LYS </select>\"; txt +=\" Residue ID : <input type='text' name='resid[]' + i><br>\"; document.getElementById('prot').innerHTML += txt; }"; [/code] This function adds a set of text boxes everytime you click a button. The problem is, when you click on the button the second time, the values in the first set of text boxes gets reset and i gotta enter them again. is there anyway to prevent that?
  4. I have this function on my php script.. [code] echo " function add() { var i =1; var txt = \"SEGID : <select name='segid[]'>"; for ($i=0; $i<count($atm); $i++) { echo "<option value='PRO$atm[$i]'>PRO$atm[$i]"; } echo "</select>\"; txt +=\" Residue : <select name='resi[]'> <option value=ASP>ASP <option value=GLU>GLU <option value=LYS>LYS </select>\"; txt +=\" Residue ID : <input type='text' name='resid[]' + i><br>\"; document.getElementById('prot').innerHTML += txt; }"; [/code] This function adds a set of text boxes everytime you click a button. The problem is, when you click on the button the second time, the values in the first set of text boxes gets reset and i gotta enter them again. is there anyway to prevent that?
  5. nogray.. you rock! Thanks a lot! and just one more question, now we have so many text boxes, how do i read the data submitted in this box? The script reads only the value in the last box. should i put the name of the form as resid[] ? instead of just resid?
  6. This works only on tar files, If you want it for a zip file, just use a command to list the files in the zip file in the $command statement instead!
  7. I got it! Just some stupid mistakes. Now, when i click the text box, The 3 boxes show up right at the bottom of the document, can i make it show up right after the text box?
  8. Doesnt seem to work again now. I think i screwed up something. [code] echo "<head> <script language=\"javascript\">"; echo " function add() { var txt = \"<input type='checkbox' name=prot[] value='prot'> Selection of Protonation of Residues:<br>SEGID : <select name='segid'>"; for ($i=0; $i<count($atm); $i++) { echo "txt += <option value='PRO$atm[$i]'>PRO$atm[$i]"; } echo "txt +=</select>\") txt +=\"Residue : <select name=resi> <option value=ASP>ASP <option value=GLU>GLU <option value=LYS>LYS </select>\"; txt +=\"Residue Id : <input type='text' name='resid' onClick='add()'><br>\"); document.getElementById('code').innerHTML += txt; }"; echo " </script> </head>"; echo "<br> <input type=checkbox name=prot[] value='prot'> Selection of Protonation of Residues:<br>"; echo "SEGID : <select name=segid> "; for ($i=0; $i<count($atm); $i++) { echo "<option value=PRO$atm[$i]>PRO$atm[$i]"; } echo "</select> Residue : <select name=resi> <option value=ASP>ASP <option value=GLU>GLU <option value=LYS>LYS </select> Residue Id : <input type=\"text\" name=\"resid\" onClick=\"add()\"><p> <body onload=\"add();\"> <div id=\"code\">"; [/code]
  9. You could do this another way, if the script is running on linux [code] $command = "tar -tvf $file > file.output" system ($command, $output); $lines = file(file.output); $num_lines = count ($lines); echo "The Zip file has $num_lines lines"; [/code] easy :)
  10. \"add()\" doesnt work. Thats what i tried, that last one was a typo, sorry.
  11. Dude, you are amazing dude. Its working now! thanks a lot :) Just one little problem in the following line, the onClick doesnt work, i tried /"add()/" and it still doesnt work. what do i do? [code] document.write(\"Residue Id : <input type='text' name='resid' onClick='add()'><br>\") [/code]
  12. Ok, I removed the Function add() and the function cat() started to work alright, so There's something wrong with the first function. The Generated Code [code] function add() { var i = 1; document.write("<input type='checkbox' name=prot[] value="prot"> Selection of Protonation of Residues:<br>SEGID : <select name="segid"><option value="PROA">PROA<option value="PROB">PROB<option value="PROC">PROC<option value="PROD">PROD</select>") document.write("Residue : <select name=resi> <option value=ASP>ASP <option value=GLU>GLU <option value=LYS>LYS </select>") document.write("Residue Id : <input type="text" name="resid" + i onClick="add()"><br>") } [/code] PHP Code [code] function add() { var i = 1; document.write(\"<input type='checkbox' name=prot[] value=\"prot\"> Selection of Protonation of Residues:<br>SEGID : <select name=\"segid\">"; for ($i=0; $i<count($atm); $i++) { echo" <option value=\"PRO$atm[$i]\">PRO$atm[$i]"; } echo "</select>\") document.write(\"Residue : <select name=resi> <option value=ASP>ASP <option value=GLU>GLU <option value=LYS>LYS </select>\") document.write(\"Residue Id : <input type=\"text\" name=\"resid\" + i onClick=\"add()\"><br>\") }"; [/code]
  13. [code] <script language="javascript"> function add() { var i = 1; document.write("<input type='checkbox' name=prot[] value="prot"> Selection of Protonation of Residues:<br>SEGID : <select name="segid"><option value="PROA">PROA<option value="PROB">PROB<option value="PROC">PROC<option value="PROD">PROD</select>") document.write("Residue : <select name=resi> <option value=ASP>ASP <option value=GLU>GLU <option value=LYS>LYS </select>") document.write("Residue Id : <input type="text" name="resid" + i onClick="add()"><br>") } function cat(txt) { alert(txt) } </script> </head><br> <input type=checkbox name=prot[] value='prot'> Selection of Protonation of Residues:<br>SEGID : <select name=segid> <option value=PROA>PROA<option value=PROB>PROB<option value=PROC>PROC<option value=PROD>PROD</select> Residue : <select name=resi> <option value=ASP>ASP <option value=GLU>GLU <option value=LYS>LYS </select> Residue Id : <input type="text" name="resid" onClick="cat('Hello')"><p><br> [/code] Thats my generated Code. it seems alright to me.
  14. No change :( I tried that at first, because it dint work, i changed it to \"checkbox\"
×
×
  • 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.