login  Naam:   Wachtwoord: 
Registreer je!
 Forum

Uploaden (Opgelost)

Offline finduilas - 13/05/2008 20:04
Avatar van finduilasPHP gevorderde Hallo,

Ik heb een vraag. Ik heb de volgende mappenstructuur

images
-allerlei
nl
-popups
fr
-popups

Ik heb een script in de map popups in zowel nl als fr. Maar hoe kan ik nu vanuit de map popups een bestand uploaden in allerlei?

Als destinationpath ../images/allerlei/ werkt niet.

Finduilas

3 antwoorden

Gesponsorde links
Offline finduilas - 13/05/2008 20:22
Avatar van finduilas PHP gevorderde Hmmz,

Het is idd zo maar toch wil dit niet werken:
  1. <?php
  2. ?>
  3. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  4. <html>
  5. <head>
  6. <title>openWYSIWYG | Select Color</title>
  7. </head>
  8. <script language="JavaScript" type="text/javascript">
  9. /* ---------------------------------------------------------------------- *\
  10. Function : insertImage()
  11. Description : Inserts image into the WYSIWYG.
  12. \* ---------------------------------------------------------------------- */
  13. function insertImage(url,alt,align,border,hspace,vspace) {
  14. var image = '<img src="' + url + '" alt="' + alt + '" alignment="' + align + '" border="' + border + '" hspace="' + hspace + '" vspace="' + vspace + '"/>';
  15. window.opener.insertHTML(image, 'text1');
  16. window.close();
  17. }
  18.  
  19. </script>
  20. <body bgcolor="#EEEEEE" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
  21. <?php
  22. if ($_SERVER['REQUEST_METHOD'] == "POST")
  23. {
  24.  
  25. $alt= $_POST['alt'];
  26. $alignment= $_POST['alignment'];
  27. $border = $_POST['borderThickness'];
  28. $hspace = $_POST['horizontal'];
  29. $vspace = $_POST['vertical'];
  30. if(!empty($_POST['imageurl']))
  31. {
  32. $url = $_POST['imageurl'];
  33. ?>
  34. <script type="text/javascript">
  35. var uitvoeren = insertImage('<?php echo $url; ?>','<?php echo $alt; ?>','<?php echo $alignment; ?>','<?php echo $border; ?>','<?php echo $hspace; ?>','<?php echo $vspace; ?>');
  36. </script>
  37. <?php
  38. }
  39. elseif(!empty($_FILES['imageurl2']))
  40. {
  41. $url = $_FILES['imageurl'];
  42. $van = $_FILES['imageurl2']['tmp_name'];
  43. $bestand = $_FILES['imageurl2']['name'];
  44. $naar = $_SERVER['SERVER_NAME'].'/images/allerlei/'.$bestand;
  45. if(move_uploaded_file($van, $naar))
  46. {
  47. $url = $_SERVER['SERVER_NAME'].'/images/allerlei/'.$bestand;
  48. ?>
  49. <script type="text/javascript">
  50. var uitvoeren = insertImage('<?php echo $url; ?>','<?php echo $alignment; ?>','<?php echo $border; ?>','<?php echo $hspace; ?>','<?php echo $vspace; ?>');
  51. </script>
  52. <?php
  53. }
  54. else
  55. {
  56. echo 'mislukt';
  57. }
  58. }
  59. else
  60. {
  61. ?>
  62. <script language="Javascript" type="text/javascript">
  63. window.close();
  64. </script>
  65. <?php
  66. }
  67. }
  68. else
  69. {
  70. ?>
  71. <table border="0" cellpadding="0" cellspacing="0" style="padding: 10px;"><form action="<?php $_SERVER['REQUEST_URI']; ?>" method="post" enctype="multipart/form-data"><tr><td>
  72.  
  73. <span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">Insert Image:</span>
  74. <table width="380" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;">
  75. <tr>
  76. <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="80">Image URL:</td>
  77. <td style="padding-bottom: 2px; padding-top: 0px;" width="300"><input type="text" name="imageurl" id="imageurl" value="" style="font-size: 10px; width: 100%;"></td>
  78. </tr>
  79. <tr>
  80. <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="80">Locale afbeelding:</td>
  81. <td style="padding-bottom: 2px; padding-top: 0px;" width="300"><input type="file" name="imageurl2" id="imageurl2" style="font-size: 10px; width: 100%;"></td>
  82. </tr>
  83. <tr>
  84. <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Alternate Text:</td>
  85. <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="alt" id="alt" value="" style="font-size: 10px; width: 100%;"></td>
  86. </tr>
  87. </table>
  88.  
  89.  
  90.  
  91. <table width="380" border="0" cellpadding="0" cellspacing="0" style="margin-top: 10px;"><tr><td>
  92.  
  93. <span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">Layout:</span>
  94. <table width="185" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;">
  95. <tr>
  96. <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="100">Alignment:</td>
  97. <td style="padding-bottom: 2px; padding-top: 0px;" width="85">
  98. <select name="alignment" id="alignment" style="font-family: arial, verdana, helvetica; font-size: 11px; width: 100%;">
  99. <option value="">Not Set</option>
  100. <option value="left">Left</option>
  101. <option value="right">Right</option>
  102. <option value="texttop">Texttop</option>
  103. <option value="absmiddle">Absmiddle</option>
  104. <option value="baseline">Baseline</option>
  105. <option value="absbottom">Absbottom</option>
  106. <option value="bottom">Bottom</option>
  107. <option value="middle">Middle</option>
  108. <option value="top">Top</option>
  109. </select>
  110. </td>
  111. </tr>
  112. <tr>
  113. <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Border Thickness:</td>
  114. <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="borderThickness" id="borderThickness" value="" style="font-size: 10px; width: 100%;"></td>
  115. </tr>
  116. </table>
  117.  
  118. </td>
  119. <td width="10">&nbsp;</td>
  120. <td>
  121.  
  122. <span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">Spacing:</span>
  123. <table width="185" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;">
  124. <tr>
  125. <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="80">Horizontal:</td>
  126. <td style="padding-bottom: 2px; padding-top: 0px;" width="105"><input type="text" name="horizontal" id="horizontal" value="" style="font-size: 10px; width: 100%;"></td>
  127. </tr>
  128. <tr>
  129. <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Vertical:</td>
  130. <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="vertical" id="vertical" value="" style="font-size: 10px; width: 100%;"></td>
  131. </tr>
  132. </table>
  133.  
  134. </td></tr></table>
  135.  
  136. <div align="right" style="padding-top: 5px;"><input type="submit" value=" Submit " style="font-size: 12px;" >&nbsp;<input type="submit" value=" Cancel " style="font-size: 12px;" onClick="window.close()"></div>
  137.  
  138. </tr></td></form></table>
  139. <?php
  140. }
  141. ?>
  142. </body>
  143. </html>

allerlei heeft alle rechten en het script heeft al gewerkt...
Offline Ibrahim - 13/05/2008 20:43 (laatste wijziging 13/05/2008 20:46)
Avatar van Ibrahim PHP expert Ik zou eerder gaan voor:

  1. $_SERVER['DOCUMENT_ROOT']


edit: zet je form tag buiten je tabel:

  1. <form ....>
  2. ...
  3. </table>
  4. </form>
Offline finduilas - 13/05/2008 21:37
Avatar van finduilas PHP gevorderde Dat laatste werkt .

Thnx!
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.211s