Jump to content

Jim from Oakland

Members
  • Posts

    41
  • Joined

  • Last visited

Everything posted by Jim from Oakland

  1. Am getting back to coding after a while away. I remember a lot but cannot remember even more. In a variable within a class I have a file name. I want to extract the file name EXTENSION. I am using end (to get last array entry) with explode (which makes 2 element array containing 1. the file name w/o extension and 2. the extension itself) as follows: $sFileExt = end(explode('.', $FileName)); I get this notice: Only variables should be passed by reference. I did try making the delimiter (a period char) a variable too. Same message. I does work by the way.
  2. I need some assistance with php specifically and web dev generally. I am a fairly proficient programmer per se. Have done non-web programming, especially Excel VBA. Before that I did some basic and a bit of C. I've done some reasonably sophisticated stuff with html and php including some cool php classes and even a bit of AJAX. But a lot of it is just hacking! I'd rather spend time doing the beefy stuff rather than tinkering, testing, trying, failing, misunsderstanding so many topics like I do now. All too often I stumble over otherwise basic topics that I know too little about (e.g. HTTP, CSS, java script, Apache etc. etc.). Worse yet, its hard to know just what I don't know. For example, the more I read about sessions and cookies the more I'm confused. I'm still not clear about what to do if cookies are turned off. Some say pass session id via url or via a POST. Others say no never. I hacked for three hours just trying to figure out how to determine if cookies are enabled! Errrghh. I have some smallish personal projects that I want to do -- nothing too sophisticated I think -- and some hope of doing some more sophisticated stuff like on-line publishing of a "modularized" version of a large report requiring much more sophisticated "content management" expertise than I have. I'm hoping to find someone who is knowledgeable and proficient with php and web generally and who'll work on a retainer type arrangement: e.g. I send some bucks -- say for five hours at a time -- and you work until that amount is used up. Hourly rate is negotiable and, of course, based on experience. Jim jim@jimeyer.net
  3. Phreax I need to sort an array (configured as shown) based on one of the second dimension keys. [1] ['File_Name'] => test.doc; [1] ['File_Type'] => MS Word; [1]['Size'] => 50; [2]['File_Name'] => test.pdf; [2]['File_Type'] => Adobe PDF [2]['Size'] => 150 [3]['File_Name'] => test.xls; [4]['File_Type'] => MS Excel; [5]['Size'] => 60; For example, I'd like the order of the 1st dimension keys (integer indices) to reflect the order if the array is sorted by the "File_Type" key. Jim (sort of)
  4. phreax I posted this on javascript too. I want to initiate a download from client computer, with button click. I do not want the browser to try to open the file like it does on a normal link. I'd like to use browsers' save as dialog, like using the right click in IE that provides the "Save Target As" option. Thanks a lot!
  5. I THINK this is the right place to ask... I have a file listing that serves up LINKS to files in a directory. I would like to give users the option to "save" the file to her/his computer. Here's what I want: In IE if I right click on the link I get the "Save (target) As" dialog box. How do I do that that with a button? Specifically what might js code look like? pseudo code <script "language=javascript"> function saveAsDialog(sFileName) { fileSaveAs("application/text", sFileName); } </script> Jim
  6. Apaches I am using a modified version of the basic, commonly available php code (e.g. it can be found at the php manual website) which allows user to upload a file to a directory at my website. I am using the same EXACT same code on two different accounts at the same hosting service. The code works swimingly on one account and not the other. The $_FILES array reports error # 6 which is something like "cannot find temporary directory" (where file is uploaded to). The hosting service uses Apache. The hosting service provider tells me that they do not provide "support" for php so for the moment I am stuck. I hope to be able ask them about more specific things to check for me. OR, can I tell the web server (using code) where to store the uploaded file? Thanks.
  7. This is not solved. Perhaps I need to try another topial forum?
  8. Thanks teng84 I DID do the print_r($_FILE). That is how I know that the web server (Apache) cannot locate the temp directory where the uploaded file goes. I get error # 6. I can also see the file name.
  9. Thanks for the suggestion If youlook closely at my codeyou'll see that I am doing exactly the same action as the suggested code. FWIW I did try it anyway and it ALSO gives error #6, temp directory not found. I presume that this error has to do with something my host service is doing; but I am at a dead end with them. Jim
  10. Phreax I'm a lightweight PHPer so go easy on me. I am using basic, commonly available php code (e.g. at php manual website) to allow user to upload a file. I am using the same exact code on two different accounts from the same hosting service. Code works fine on one account and not the other. $_FILES array reports error # 6 which is something like "cannot find temporary directory" (where file is uploaded to). Host company tells me that they do not provide "support" for php so for the moment I am stuck. I hope to be able ask them about more specific things to check for me. OR, can I tell the web server (using code) where to store the uploaded file? Thanks.
  11. oops, wrt to parseInt()... ...If the first non-whitespace character is not numeric, the function returns the Not-a-Number value NaN. Perhaps the regex option is the one I need.  Does someone have an example of how to do it in javascript? TIA phreax
  12. Based on content of a variable holding the id/name of a specific html input field like this: sInputName = 'item11_element23_value'; I need to extract the item number and element number from that name (11 and 23 respectively, in the example.)  //for the example would return 11 iItemIndex = extractItemIndex(); //for the example would return 23 iElementIndex = extractElementIndex(); There may be as many as three  digits for either criterion. Thanks soo much!
  13. I found the error.  It DID relate to a field with a name attribute but not an id attribute. FYIyou can indeed useinputs that are notin a form.  The must have an ide attribute though.
  14. Thanks again fenway! Need id Indeed!  I typed the example hidden input tag in the previous post rather than say copying it from the html source.  Here is what I have in the html source. <INPUT type="hidden" name="Item1Price" id="Item1Price" value=60.5> <INPUT type="hidden" name="Item1Qty" id="Item1Qty" value=0> I am NOT using a form, just a few input (events) that js responds to. Might that be THE solution?
  15. "escape" single quotes alert('Bob\'s Friends\' houses');
  16. fenway Thanks for offering to assist.  I'm not sure how to be more clear. That is the exact code.  It is in a longer js function that does the same thing several times. The entire funciton works fine in IE but in Navagator it does not. I am merely looking to get the value from a hidden input field. In my example the hidden field name is Item1Price <input type="hidden" name="Item1Price" value=12.99> How do I retrieve the value 12.99? Note: pItemIndex is an integer.
  17. phreaks I am a total hacker in javascript!  In IE I get the value of a hidden input as shown.  In Netscape the last statement chokes. What syntax might I try? pItemIndex = 1; sValueFieldName = 'Item' + pItemIndex + 'Price'; oValueField = document.getElementById(sValueFieldName); dValue = oValueField.value;
  18. I tried sequentially named strings as keys for $_SESSION instead of the three dimension array approach and the session data was retrieved. Thanks. You did help me! So, instead of $itemIndex=2; $elementIndex=3; $_SESSION[$ItemIndex][$elementIndex]['name'] = 'red'; used $_SESSION['item_' . $ItemIndex . 'element_' . $elementIndex . 'name'] = 'red'; Should the former approach work?
  19. Darnitall! I get the same results you do.  BUT, when I fill the session array with name/value pairs the values do not seem to persist. I use $_SESSION[$itemToProcess][$elementIndex]['name'] = $_POST[$elementNameVarName]; $_SESSION[$itemToProcess][$elementIndex]['value'] = $_POST[$elementValueVarName]; and when using print_r on $_SESSION I see that it is filled but next time into the script (via ajax) none of the previously processed questions' name/value data is retrieved. Ideas?
  20. Thanks btherl and sorry for convolution. Hows this: I need to use a string that I create to specify a session, rather than letting php name the session. The string will be in variable $_POST['Ref'] example, $_POST['Ref'] contains '061212aq1' How do I use that string to a) create a session with that name (id?) then b) access that session once it is created. I do not know the difference beteen session ID and session NAME. I've tried various combinations of $sessionID = $_POST['Ref']; session_name($sessionID); session_id($sessionID); session_start();
  21. This is MOSTLY a session question but I'm using ajax... I was able to hack ajax so that I can cycle through separate survey questions individually and retrieve user responses (in the ajax request processor) using post variables. But, I need to keep track of the responses for all questions as they are submitted. I send the form's unique id (as a post variable) each time a question is submitted and want to use that string (letters and numbers only so it should be a vaild session id) to specify/identify a session. So, in the script that processes the ajax request for each question how do I use the string in $_POST['Ref'] to reinstate a session?
  22. Eh Jacks! This is MOSTLY a session question but I'm doing ajax so... I was able to hack ajax so that I can cycle through separate survey questions individually and retrieve user responses (in the ajax request processor) using  post variables. But, I need to keep track of the responses for all questions as they are submitted. I send the form's unique id (as a post variable) each time a question is submitted and want to use that string (letters and numbers only so it should be a vaild session id) to specify/identify a session. So, in the script that processes the ajax request foreach question how do I use the string in $_POST['Ref'] to reinstate a session?
  23. Phreax This must be a common task.  I need delete files that are more than 24 hours old from a specific directory (no subdirectories). Thanks very much for your assistance. Jim
×
×
  • 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.