Jump to content

Bogey

Members
  • Posts

    265
  • Joined

  • Last visited

Everything posted by Bogey

  1. Bogey

    INPUT type=file

    Oke I am back :S This are 2 ways I tried, but did not work <DIV class='fillDBwrapper' id='divFotos'><INPUT type='file' name='uploaded' id='uploaded' onChange="load('addFoto.php', 'divFotos');"/><INPUT type='file' name='uploaded' id='uploaded' onChange="addFoto('divFotos')"/></DIV> addFoto.php: if ($_FILES['uploaded']['name']){echo "FILE SELECTED";}else{echo "NO FILE SELECTED";}die; The first one ("load") is an AJAX function? How can I asign that function to my page?The second one runs, and also echo's to the right div, but echo's NO FILE SELECTED! Has to be with the problem, that JS is userside and PHP is serverside, but cant get it managed... Javascript: function addFoto(targetDiv){fillContent('modules/secure/addFoto.php', targetDiv);} var xmlhttp;function run_xmlhttp() {if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safarixmlhttp=new XMLHttpRequest();}else {// code for IE6, IE5xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}}function fillContent(content, targetDiv){run_xmlhttp();xmlhttp.onreadystatechange=function() {if (xmlhttp.readyState==4 && xmlhttp.status==200) {document.getElementById(targetDiv).innerHTML=xmlhttp.responseText;}}xmlhttp.open('GET', content, true);xmlhttp.send();} I rather dont want to use a FORM for above, cause this is already in a FORM... and form inside form wont work...Is it possible to send the 'addPhoto.php' to the same div as where the input file button is? This div show the already added pictures, but when clicking the input file button, then I want user to pick a photo from pc and after picked picture, php saves picture to server, and the div has to be reloaded, showing also the just newly added picture... I don't want a submit button, but I want code running right after user picked a picture from pc... (and yes code is checking for extension, to make sure picture has picked.... if not, user gets an error, so has to pick again... I hope I am clear about this, with my not 100% perfect English...
  2. Bogey

    INPUT type=file

    I am already busy on thisone again I come back to it later... I have some ideas, going to try it out
  3. Oke, here I am again!!! This I in my template gives no errors: <script type="text/javascript" src="jscript/jquery.js" charset="utf-8"></SCRIPT><script type="text/javascript" src="jscript/prettyPhoto/js/jquery.prettyPhoto.js" charset="utf-8"></SCRIPT><script type="text/javascript" src="jscript/jquery.js" charset="utf-8"></SCRIPT> This in my template does give error: <script type="text/javascript" src="jscript/jquery.js" charset="utf-8"></SCRIPT><script type="text/javascript" src="jscript/prettyPhoto/js/jquery.prettyPhoto.js" charset="utf-8"></SCRIPT> Uncaught TypeError: Property '$' of object [object DOMWindow] is not a function(anonymous function) So I use the add JQuery twice for now... hope you can tell me, why I need it twice? So what must I have been doing wrong?When I use it once, then I also don't get the PrettyPhoto pop-up window.... then it opens in a new window instead.... when I add JQuery twice, then the PrettyPhoto window pops-up... The other thing I can't get right:This is in my template: <LINK rel="stylesheet" href="jscript/prettyPhoto/css/prettyPhoto.css" type="text/css" media="screen" charset="utf-8" /> <script type="text/javascript" src="jscript/jquery.js" charset="utf-8"></SCRIPT><script type="text/javascript" src="jscript/prettyPhoto/js/jquery.prettyPhoto.js" charset="utf-8"></SCRIPT><script type="text/javascript" src="jscript/jquery.js" charset="utf-8"></SCRIPT><script type="text/javascript" src="js/basicfunctions.js"></SCRIPT> <DIV id='test'><DIV id='test1'><A href='images/test/00004000000404.jpg' rel='prettyPhoto'><img src='images/test/thumbs/00004000000404_thumb.jpg' alt='SamplePic' height='100em' width='100em' /></A><A href="javascript:void()" onclick="fillContent('test.php','test2')">ToDIV</A><BR /></DIV><DIV id='test2'></DIV></DIV> test.php: <H1>Testing</H1><A href='images/test/00004000000404.jpg' rel='prettyPhoto'><img src='images/test/thumbs/00004000000404_thumb.jpg' alt='SamplePic' height='100em' width='100em' /></A> basicfunctions: var xmlhttp;function run_xmlhttp() {if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safarixmlhttp=new XMLHttpRequest();}else {// code for IE6, IE5xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}}function fillContent(content, targetDiv){run_xmlhttp();xmlhttp.onreadystatechange=function() {if (xmlhttp.readyState==4 && xmlhttp.status==200) {document.getElementById(targetDiv).innerHTML=xmlhttp.responseText;}}xmlhttp.open('GET', content, true);xmlhttp.send();} when I open template, then DIV1 gives the picture, and when clicking the picture opens in PrettyPhoto popup window.when I click 'ToDIV' link in the DIV1, then DIV2 is filled with the 'test.php', and I see the picture there, but when clicking, then it opens not in the PrettyPhoto popup, but it opens in a new page... Any clues on the 2 things above? ;)1.) The double insert op JQuery2.) JQuery not working in newly filled div The second one has something to do I think about PrettyPhoto has to be reloaded, cause of the new php.page in div, so the items in DIV2 didn't get the events... but cant get it right...
  4. I thougth I was going crazy!!! hehehe But I figured out, what was wrong... in 1 .php file I was having 2 pages (if bla bla then page1, else page2).... pppfffff... I come back to it, to mention I got it working how I want, or to ask more questions Thnx!
  5. Still busy on this one, but hope to can get it right bit by bit This gives NO error! <script type="text/javascript" src="jscript/jquery.js" charset="utf-8"></SCRIPT><script type="text/javascript" src="jscript/prettyPhoto/js/jquery.prettyPhoto.js" charset="utf-8"></SCRIPT><script type="text/javascript" src="jscript/jquery.js" charset="utf-8"></SCRIPT> This gives a error: <script type="text/javascript" src="jscript/prettyPhoto/js/jquery.prettyPhoto.js" charset="utf-8"></SCRIPT><script type="text/javascript" src="jscript/jquery.js" charset="utf-8"></SCRIPT> Error:-Uncaught ReferenceError: jQuery is not defined-Uncaught TypeError: Property '$' of object [object DOMWindow] is not a function This gives a error: <script type="text/javascript" src="jscript/jquery.js" charset="utf-8"></SCRIPT><script type="text/javascript" src="jscript/prettyPhoto/js/jquery.prettyPhoto.js" charset="utf-8"></SCRIPT> Error:-Uncaught TypeError: Property '$' of object [object DOMWindow] is not a function But I guess loading jquery.js two times is not the right way? So why is that line needed twice? Before and after the prettyPhoto part?
  6. hey folks, I have for example a MAIN_PAGE, with different div's inside it... example: <A href='images/test/00004000000404.jpg' rel='prettyPhoto'><img src='images/test/thumbs/00004000000404_thumb.jpg' alt='Cover CD 1' height='200em' width='200em' /></A> So when photo is clicked, then it appears in the nice prettyPhoto window.... BUT when I change the content of the div (useing JS/AJAX) with something new, and this something new also has <A href='images/test/00004000000404.jpg' rel='prettyPhoto'><img src='images/test/thumbs/00004000000404_thumb.jpg' alt='Cover CD 1' height='200em' width='200em' /></A> inside it, then after clicking the photo, it isn't opening in the nice prettyPhoto window, but instead it opens in a new window! How can I manage to get around that? I guess somehow the JQuery(prettyPhoto) has to been reloaded in the div, so the page knows that the <a> still has to behave prettyPhoto like...
  7. Bogey

    INPUT type=file

    Now I have written a piece of code, that allows the user to select pictures to upload (10 times a type=file input) and then click ones on OK to crop each of those pictures to smaller kb's (for picture) and tiny kb's (for thumbnail) at once... This I wrote in php... Do you mean I have to rewrite this part also in JS/AJAX to manage what I want instead of re-use my already written php-code? :S
  8. Bogey

    INPUT type=file

    Hi all, I want user add photo's to my website! 3 things I wanna know! 1.) Now I have two buttons: <FORM enctype='multipart/form-data' action='test_addfile.php?' method='post'><INPUT type="file" name="uploaded" id="uploaded"/><INPUT name="submit" type="submit" id="submit" name="Voeg nieuwe foto toe"/><FORM> But I want it in just ONE button, something like: <FORM><INPUT type="file" name="uploaded" id="uploaded" enctype='multipart/form-data' onclick="test_addfile.php" onchange="test_addfile.php"/><FORM> Can this work somehow, or do I really need the 2 buttons? 2.) Now "test_addfile.php" is run as a new page, but I don't want the echo's from this file like a new page, but I want those echo's inside a certain DIV on the current page. Is that possible? How? Also with the "xmlhttp.onreadystatechange" thing? 3.) Is it possible somehow to have a <FORM enctype='multipart/form-data' action='test_addfile1.php'> inside another <FORM enctype='multipart/form-data' action='test_addfile2.php'>??? I tried it, but the inner FORM uses also the outer'test_addfile1.php' instead of 'test_addfile2.php'... Thnx all!
×
×
  • Create New...