I want to include a file upload script on my website. The FTP max file size is unlimited, but the HTTP max file size is lower than the files I want to upload.
Would using the PHP FTP functions with a file upload form get around this problem, or will it still use HTTP to upload the file to the temporary directory.
User Profile
Collapse
-
FTP vs. HTTP file upload limit
-
I solved the problem. I have a header.php file that is included at the top of every page. I did a check to see if one of the sessions was set. If it wasn't, I explicitly set it to NULL.
Code:if (!isset($_SESSION['id'])) { $_SESSION['id'] = NULL; $_SESSION['f_name'] = NULL; $_SESSION['l_name'] = NULL; $_SESSION['username'] = NULL; $_SESSION['status'] = NULL; } -
What you have to do is include the javascript file, preferably between the <head></head> tags. Then you would set the onclick to the function. For example,
...Code:<head> <script language="javascript" src="path/to/external.js"></script> </head> <body> <img src="path/to/image.gif" onclick="function_name()" /> </boLeave a comment:
-
So I used the same php code, modified a little bit to format correctly but basically the same, and took out the AJAX function. The same problem still occurs so I am sure something is wrong with my login.php, but I don't know what.Leave a comment:
-
Thanks for the response oranoos3000,
- I did use session_start() on line 3 of login.php
- I dont understand what you mean by 'appropriate part'. I made login.php echo back the html and the AJAX function uses innerHTML to put the response on the page.
I did do an echo "$_SESSION['username']"; statement before and at the end of the AJAX function, it would return the correct variable, so I know that the session was set....Leave a comment:
-
PHP and AJAX Session not persisting.
I have a a PHP script that does all the logging in and creating session. I also have some javascript that uses AJAX to make a request to the PHP script and return the response. The problem I run into is that the session is being set, but as soon as I go to a different page or refresh, the session data goes away. Here are my scripts:
login.php:
...Code:<?php session_start(); // Initializing -
-
JavaScript Style.display not working
I cant get the style.display property to work properly. I have this test html page:
...Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test -
I fooled around with it and this finally worked:
Thanks for your help dlite. Simplifying it really helped.Code:$q = "UPDATE debator SET points = '$points', win = '$win', loss = '$loss', aff_win = '$aff_win', aff_loss = '$aff_loss', neg_win = '$neg_win', neg_loss = '$neg_loss', aspeaks = '$aspeaks', aff_aspeaks = '$aff_aspeaks', neg_aspeaks = '$neg_aspeaks' WHERE name = '$name'";
Leave a comment:
-
Thanks for the help. I changed them all to shorter variables and created this query.
I removed the single quotes around everything except for $name since they are all integers....Code:$q = "UPDATE debator SET points = $points, win = $win, loss = $loss, aff_win = $aff_win, aff_loss = $aff_loss, neg_win = $neg_win, neg_loss = $neg_loss, aspeaks = $aspeaks, aff_aspeaks = $aff_aspeaks, neg_aspeaks = $neg_aspeaks WHERE name = '$name';";
Leave a comment:
-
MYSQL Update Query Syntax
I am trying to run a really long Update query for my mysql database, but I keep getting a syntax error.
...Code:$q = "UPDATE debator SET points = '" . mysqli_real_escape_string($link, $v[$POINTS]) . "', win = '" . mysqli_real_escape_string($link, $v[$WIN]) . "', loss = '" . mysqli_real_escape_string($link, $v[$LOSS]) . "', aff_win = '" . mysqli_real_escape_string($link, $v[$AFF_WIN]) . "', aff_loss = '"
-
I am uploading the data through a form. I found by using this:
It returns the data as an array with each new line as a separate array entry. Thanks for your help though.Code:$data = file($_FILES["file"]["tmp_name"], FILE_USE_INCLUDE_PATH | FILE_IGNORE_NEW_LINES);
Leave a comment:
-
file_get_contents() not showing new lines
I am trying to parse certain excel sheets. I converted them to csv files to strip out any excess formatting. To parse these files, my system is dependant on new lines ("/n"). I use this code to get the data from the uploaded csv file:
The problem is that any of the new lines in the csv show up as single spaces...Code:$data = file_get_contents($_FILES["file"]["tmp_name"], FILE_USE_INCLUDE_PATH);
-
Thank you very much. I was putting the single quotes on the column names instead of the values.Leave a comment:
-
Let me just add the differences between cookies, sessions, and session cookie's.
COOKIES
Whenever you create a cookie, a file on the person's computer is made to hold all the information and data you want to carryover. This is very useful since it doesn't take up space on your server. Your site can only access the cookies that originated from your site.
SESSIONS
Sessions are like cookies in that they hold the...Leave a comment:
-
dlite's explanation was very good. Especially his explanation of the differences between Java, Javascript, Ajax, server-side languages, and client-side languages. These are important concepts.
However, it might be a daunting task for you to have to learn a new language, Javascript, since you stated your problem is urgent. To get around the refreshing problem and having to learn javascript, there is a little trick I picked up a while...Leave a comment:
-
Normally to do this you would have to send a header, but headers must always be sent before anything else to the browser or you will get an error. To fix this, I create an output buffer at the beginning of my script and flush the data at the end. This buffer only sends the data to the browser once you flush the data. This allows any headers to be sent before anything and avoid any errors. So you want to do this first:
...Code:// Create
Leave a comment:
-
INSERT MySQL query always causing an error.
I am trying to create a registering script, but everytime I try to insert the data into my database i get an error.
...Code:$query = "INSERT INTO members (username, pass, email, first_name, last_name) VALUES ($username, $password, $email, $f_name , $l_name);"; $q = mysqli_real_query($dbc, $query); if($q) { // My code goes here } else { // Display an error } -
Changed that too. When I changed the if to a while I forgot about that. Thanks for pointing it out...Leave a comment:
-
I edited my post to reflect the correction. Thanks for pointing it out!...Leave a comment:
No activity results to display
Show More
Leave a comment: