|
use ftp right?write(program) a can upload's website,right?use the html 5 and javascript code,right?,im a beginner and im a chinese.i have alway practise my english
|
|
|
|
|
Here is a link that may lead you to an answer you seek.
https://code.google.com/p/html5uploader/[^]
This should allow users of your site to drag and drop a file from their OS to be uploaded to your site in their browser. This will create a button to 'browse' but then they should not have to click an upload button and therefore you should not have to display an upload button.
You can have it save to a 'dynamic' directory/folder by manipulating the save directory in the PHP page that is shown on that site's page. Let's assume that that want files save into a directory named after the user but all user's folders are inside a directory called user_uploads. You will have to set it to an "id" that, obviously, would be unique to each user of your site. If users have a unique username then it could be $username or if they have a unique ID number associated with their account then it could be $user_id .
First change the name of the upload folder to what you want...as described above I am going with user_uploads:
$upload_folder = 'user_uploads';
Then you would have to do an additional change to the lines shown below to add it to the dynamic folder with the user's unique ID.
if(file_put_contents($upload_folder/$username.'/'.$headers['UP-FILENAME'], $content)) {
echo 'done';
}
For safety's sake I would either create a new directory named with a registering members unique ID upon creation of a new account or at least right before the second code shown to make sure that they actually have an existing directory to download into. Although it might be better to go with the second option here as you may have a lot of members who do not want to upload anything and therefore you could end up with a whole lot of empty directories sitting in that parent directory. Creating the directory (with appropriate permissions to store and show images) right before the upload process could ensure that only those users/members that actually want to upload something will have a folder.
You can download the 3 files plus the .js file from that link above. However, the link to demo this in action appears to be broken. But it's pretty simple and straightforward so it shouldn't take too much work to change a couple variables, upload to your server and test it yourself.
If you have a problem with this then just try searching the web for PHP HTML5 uploading for other possible options.
Many people are working with HTML5, PHP and JQuery to create such things. Just be aware that such things can be dependent upon a user having particular version numbers of particular browsers and you should make note of it accordingly on your site.
|
|
|
|
|
Hi,
I have a two mirror sites,
http:
I am trying to use the SOAP V2 in both the sites. Its working fine in ‘http:
But in ‘http:
When I open the SOAP URL ‘http:
Not able to get what the exact error is. Pls help if possible.
|
|
|
|
|
I just had these error a few days before. The problem was with the hosts file of the server. The domain name (in your case domain) wasn't in the hosts file so it PHP wasn't able to resolve it...
You can do one these things to fix it:
1. Add new entry to hosts file
2. change url to localhost or ip
3. change url to relative
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Where do i look for the host file to make an entry into the file? I access the site folder from Plesk control panel.
|
|
|
|
|
Hi all,
I am new to magento, and know very little about the coding style. I searched a lot of forum but was unable to get a proper answer to my doubt. I have added a custom column in ‘sales_flat_order_item’ table. In cart, when a item is added, a special price is calculated for each item in the cart. I need to save this calculated price in ‘sales_flat_order_item’ table when checkout. Please check the attached image. Can anyone help me as to how can I do this?
|
|
|
|
|
Hi,
I am using this code to destroy the session after sometime but it's not working! it's always redirecting to out file? why is that?
$inactive = 100;
$session_life = time() - $_SESSION['timeout'];
if ($session_life > $inactive)
{ exit(header("Location: out")); }
$_SESSION['timeout'] = time();
Technology News @ www.JassimRahma.com
|
|
|
|
|
In your case 100 is 100 seconds (you use time() that returns the time in seconds), that is not much time and that may be the reason of frequent timeout!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
I changed it to 10000 but still having the same problem.
Technology News @ www.JassimRahma.com
|
|
|
|
|
The reason maybe that $_SESSION['timeout'] is null at the first tie you do time() - $_SESSION['timeout']. That can lead to an unpredictable large number...You have to find a way to initialize it or ask about it before use...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
what should be the value of it?
Technology News @ www.JassimRahma.com
|
|
|
|
|
time()...But it's should be a one-time initialization...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Problem solved.
Thanks guys
Technology News @ www.JassimRahma.com
|
|
|
|
|
You're welcome!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Guys
I have one more question of you don't mind...
The code I have mentioned will kill the session after specific time, let's say 10minutes regardless of what the user is doing.
Is it possible to have the same code but only when the website is idle (user had no activity on the website)?
Thanks,
Jassim
Technology News @ www.JassimRahma.com
|
|
|
|
|
You can achieve that by updating $_SESSION["timeout"] on any incoming request...
Question: Why you don't using the session timeout feature of your web server?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
modified 5-May-14 4:18am.
|
|
|
|
|
You can achieve that by updating $_SESSION["timeout"] on any incoming request...
but this will not help if the user didn't post or if the user is typing an long article and still typing until 10 minutes?
Why you don't using the session timeout feature of your web server?
How please?
Technology News @ www.JassimRahma.com
|
|
|
|
|
Jassim Rahma wrote: typing an long article That's an other story! You are talking about while user still on the client side...For that you must have some JavaScript that calls the server in certain intervals (using AJAX probably) to let server know that user still on...Google can find you a lot os samples for that...
Setting session timeout is depends on the web server you are using - see the documentation for your web server...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Ok. I am hosting with Dreamhost.
I will check with them
Thank you so much
Technology News @ www.JassimRahma.com
|
|
|
|
|
You're welcome!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
The exit() function stops the script, but does not destroy the Session.
If you intend to destroy the session, use session_destroy(). If you are using cookies to propagate the session, follow with setcookie() to clear the session Id from the user cookie.
Eric Crane
Non Profit Software Corporation
|
|
|
|
|
Hi,
I have a field called created_date in MySQL with UTC_TIMESTAMP values in it
I want to know how can I display the records for that field in the local date/time of the user depends on where he?
Thanks
Jassim
Technology News @ www.JassimRahma.com
|
|
|
|
|
Hi,
I have the following code to check if the user is_administrator then show the two menu items, otherwise of course it won't show... kindly simple! but the problem is.... when I uploaded the pages to my web host, even if the user is not administrator the menu items are shown! the value for is_administrator in MySQL is a bit = 0 but when I do a var_dump I get bool(true) although I get the correct var_dump and behavior on my local pc string(1) "0"
this is the menu items:
<?php if ((bool)$_SESSION["blended_learning_is_administrator"] = true) { ?>
<tr><td><button id="btnManageUsers" type="button" style="width: 100%;">Manage Users</button></td></tr>
<tr><td><button id="btnNewUser" type="button" style="width: 100%;">New User</button></td></tr>
<?php } ?>
and this is the is_administrator:
while ($mysql_row = $mysql_query->fetch())
{
$_SESSION["blended_learning_user_name"] = $mysql_row["user_name"];
$_SESSION["blended_learning_is_administrator"] = $mysql_row["is_administrator"];
exit(header("Location: " . $_SESSION["blended_learning_domain_name"] . "mypage"));
}
Technology News @ www.JassimRahma.com
|
|
|
|
|
I think you need to use the '==' double equals sign to check for equality. One equals sign will assign the value to the variable.
vbmike
|
|
|
|
|
Well, your problem is that you assign the value true to $_SESSION["blabla"] . I.e. it cannot work!
SolutionA:
<?php
if($_SESSION["blended_learning_is_administrator"] == true) {
}
SolutionB:
<?php
if($_SESSION["blended_learning_is_administrator"] === true) {
}
The difference between SolutionA and B is, that B also checks if $_SESSION["bla"] is of the same type as true, i.e. bool/boolean.
|
|
|
|